Skip to content

Commit aba1d5e

Browse files
authored
Deconfuse Geomean Metric and geomean aggregate value (#408) (#480)
The metric's "geomean" aggregate value can be easily confused with the top-level Geomean metric (issue #407). - Don't serialize "geomean" in the JSON data - Add descriptions to Score, Geomean, and Iteration metrics that are serialized in the JSON data - Make the detail view titles more descriptive - Merge of original PR #408
1 parent ce03cfb commit aba1d5e

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ <h1>Score</h1>
8282
<h1 class="section-header">Detailed Results</h1>
8383
<div class="section-content all-metric-results">
8484
<div class="aggregated-metric-result">
85-
<h2>Geomean</h2>
85+
<h2>Aggregate Metric</h2>
8686
<div id="geomean-chart"></div>
87-
<h2>Tests</h2>
87+
<h2>Test Metrics Overview</h2>
8888
<div id="tests-chart"></div>
8989
</div>
9090
<br />
91-
<h2>Detailed Metrics</h2>
91+
<h2>Test Metrics Details</h2>
9292
<div id="metrics-results"></div>
9393
</div>
9494
<div class="buttons section-footer">

resources/benchmark-runner.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -603,9 +603,9 @@ export class BenchmarkRunner {
603603
// Prepare all iteration metrics so they are listed at the end of
604604
// of the _metrics object, before "Total" and "Score".
605605
for (let i = 0; i < this._iterationCount; i++)
606-
iterationTotalMetric(i);
607-
getMetric("Geomean");
608-
getMetric("Score", "score");
606+
iterationTotalMetric(i).description = `Test totals for iteration ${i}`;
607+
getMetric("Geomean", "ms").description = "Geomean of test totals";
608+
getMetric("Score", "score").description = "Scaled inverse of the Geomean";
609609
}
610610

611611
const geomean = getMetric("Geomean");

resources/metric.mjs

+11-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ export class Metric {
1010
throw new Error(`Invalid metric.name=${name}, expected string.`);
1111
this.name = name;
1212
this.unit = unit;
13+
this.description = "";
1314

1415
this.mean = 0.0;
15-
this.geomean = 0.0;
16+
// Make "geomean" non-enumerable so we don't serialize it with JSON.stringify
17+
// and avoid some confusion with the top-level Geomean metric.
18+
Object.defineProperty(this, "geomean", {
19+
writable: true,
20+
value: 0,
21+
});
1622
this.delta = 0.0;
1723
this.percentDelta = 0.0;
1824

@@ -21,7 +27,6 @@ export class Metric {
2127
this.max = 0.0;
2228

2329
this.values = [];
24-
this.children = [];
2530

2631
// Mark properties which refer to other Metric objects as
2732
// non-enumerable to avoid issue with JSON.stringify due to circular
@@ -31,6 +36,10 @@ export class Metric {
3136
writable: true,
3237
value: undefined,
3338
},
39+
children: {
40+
writable: true,
41+
value: [],
42+
},
3443
});
3544
}
3645

0 commit comments

Comments
 (0)