Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions scripts/report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export function sha256(value) {
return createHash('sha256').update(value).digest('hex');
}

export function hashFilesSingle(value) {
const contentHash = createHash('sha256').update(value).digest();
return createHash('sha256').update(contentHash).digest('hex');
}
Comment on lines +13 to +16

export function secondsBetween(start, end) {
if (!start || !end) return null;
return (Date.parse(end) - Date.parse(start)) / 1000;
Expand Down Expand Up @@ -91,6 +96,7 @@ function summarize(rows, caches) {
const versionCaches = caches.filter(cache => cache.version === version);
const caseTotals = new Map();
for (const cache of versionCaches) {
if (cache.sizeBytes === null) continue;
const key = `${cache.distribution}-${cache.iteration}`;
caseTotals.set(key, (caseTotals.get(key) ?? 0) + cache.sizeBytes);
}
Comment on lines 96 to 102
Expand Down Expand Up @@ -220,11 +226,13 @@ export async function main(env = process.env) {
const expected = [
{
type: 'maven-dependencies',
key: `setup-java-Linux-x64-maven-${sha256(`${benchmarkId}\n`)}`
key: `setup-java-Linux-x64-maven-${hashFilesSingle(
`${benchmarkId}\n`
)}`
},
{
type: 'maven-wrapper',
key: `setup-java-Linux-x64-maven-wrapper-${sha256(
key: `setup-java-Linux-x64-maven-wrapper-${hashFilesSingle(
`${wrapperOriginal}# benchmark-id=${benchmarkId}\n`
)}`
}
Expand Down
5 changes: 5 additions & 0 deletions scripts/report.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import test from 'node:test';

import {
hashFilesSingle,
median,
parseBenchmarkJob,
secondsBetween,
Expand All @@ -13,6 +14,10 @@ test('hashes benchmark cache markers', () => {
sha256('benchmark\n'),
'8f8dbecfd77ab2386b49d723c6b2474f2c22c246805fa0f677bbaf6e4f7bbbfe'
);
assert.equal(
hashFilesSingle('main-microsoft-1-30462682067\n'),
'f0c1009aeb8d8582a73a81f3b0146467ed727211971e4052fccd9b7d60817d8f'
);
});

test('calculates medians', () => {
Expand Down