Skip to content

Commit

Permalink
Remove redundant runId
Browse files Browse the repository at this point in the history
  • Loading branch information
smarr committed Jun 4, 2023
1 parent 4edb33c commit 084ea8f
Show file tree
Hide file tree
Showing 14 changed files with 106 additions and 101 deletions.
4 changes: 2 additions & 2 deletions src/data-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function benchmarkId(
export function dataSeriesIds(ids: DataSeriesVersionComparison): string {
// format is parsed in compare.ts:insertProfiles()
return (
`${ids.base.commitId}/${ids.base.runId}/${ids.base.trialId},` +
`${ids.change.commitId}/${ids.change.runId}/${ids.change.trialId}`
`${ids.runId},${ids.base.commitId}/${ids.base.trialId},` +
`${ids.change.commitId}/${ids.change.trialId}`
);
}
10 changes: 8 additions & 2 deletions src/stats-data-prep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,21 @@ function getDataSeriesIds(
base: Measurements,
change: Measurements
): DataSeriesVersionComparison {
if (base.runId !== change.runId) {
throw new Error(
`runIds are expected to be the same but` +
` are: ${base.runId} and ${change.runId}` +
` for ${base.criterion.name}`
);
}
return {
runId: base.runId,
base: {
commitId: base.commitId,
runId: base.runId,
trialId: base.trialId
},
change: {
commitId: change.commitId,
runId: change.runId,
trialId: change.trialId
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/views/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ function insertProfiles(e): void {

// format is serialized in data-format.ts:dataSeriesIds()
const profilesIds = jqButton.data('content').split(',');
const runId = profilesIds.shift();
for (const ids of profilesIds) {
const [change, runId, trialId] = ids.split('/');
const [change, trialId] = ids.split('/');

const jqInsert = $(
`<tr><td class="profile-container" colspan="6"></td></tr>`
Expand Down
2 changes: 1 addition & 1 deletion src/views/view-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ export interface CompareStatsRowAcrossVersionsPartial {
*/
export interface DataSeriesId {
commitId: string; // this one is a bit redundant, it's implied by the trialId
runId: number;
trialId: number;
}

export interface DataSeriesVersionComparison {
runId: number;
base: DataSeriesId;
change: DataSeriesId;
}
Expand Down
5 changes: 2 additions & 3 deletions tests/data-format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,17 @@ describe('Format Functions for Numerical Values', () => {
describe('dataSeriesIds()', () => {
it('should return the expected string', () => {
const ids: DataSeriesVersionComparison = {
runId: 1,
base: {
commitId: '123456',
runId: 1,
trialId: 2
},
change: {
commitId: '123457',
runId: 3,
trialId: 4
}
};

expect(dataSeriesIds(ids)).toBe('123456/1/2,123457/3/4');
expect(dataSeriesIds(ids)).toBe('1,123456/2,123457/4');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ <h3 id="suite1-exe1">suite1</h3>
data-content="<code>som/some-command with args</code>"></button>
<button type="button" class="btn btn-sm btn-environment btn-popover"
data-content="MyHost | Linux | 121kb | Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz | 3GHz"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-timeline" data-content='{"b":"my-benchmark","e":"exe1","s":"suite2"}'></button></td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
data-content="<code>som/some-command with args</code>"></button>
<button type="button" class="btn btn-sm btn-environment btn-popover"
data-content="MyHost | Linux | 121kb | Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz | 3GHz"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-timeline" data-content='{"b":"my-benchmark","e":"exe1","s":"suite2"}'></button>
4 changes: 2 additions & 2 deletions tests/data/expected-results/compare-view/stats-row-exe.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
data-content="<code>som/some-command with args</code>"></button>
<button type="button" class="btn btn-sm btn-environment btn-popover"
data-content="MyHost | Linux | 121kb | Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz | 3GHz"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-timeline" data-content='{"b":"my-benchmark","e":"exe1","s":"suite2"}'></button></td>
</tr>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
data-content="<code>som/some-command with args</code>"></button>
<button type="button" class="btn btn-sm btn-environment btn-popover"
data-content="MyHost | Linux | 121kb | Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz | 3GHz"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-timeline" data-content='{"b":"my-benchmark","e":"exe1","s":"suite2"}'></button></td>
</tr>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
data-content="<code>som/some-command with args</code>"></button>
<button type="button" class="btn btn-sm btn-environment btn-popover"
data-content="MyHost | Linux | 121kb | Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz | 3GHz"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-timeline" data-content='{"b":"my-benchmark","e":"exe1","s":"suite2"}'></button></td>
</tr>
4 changes: 2 additions & 2 deletions tests/data/expected-results/compare-view/stats-tbl.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
data-content="<code>som/some-command with args</code>"></button>
<button type="button" class="btn btn-sm btn-environment btn-popover"
data-content="MyHost | Linux | 121kb | Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz | 3GHz"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="123456/1/2,123457/3/4"></button>
<button type="button" class="btn btn-sm btn-light btn-warmup" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-profile" data-content="1,123456/2,123457/4"></button>
<button type="button" class="btn btn-sm btn-timeline" data-content='{"b":"my-benchmark","e":"exe1","s":"suite2"}'></button></td>
</tr>
</tbody>
Expand Down
Loading

0 comments on commit 084ea8f

Please sign in to comment.