Skip to content

Commit c8b6fc1

Browse files
authored
Merge pull request #2289 from Kobzol/aggregation-total
Add total accumulated change to the Aggregations tab
2 parents 58dceae + dd017e8 commit c8b6fc1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

site/frontend/src/pages/compare/compile/aggregations.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import SummaryTable from "../summary/summary-table.vue";
55
import {createPersistedRef} from "../../../storage";
66
import {PREF_AGGREGATIONS_OPENED} from "../prefs";
77
import {CompileTestCase} from "./common";
8+
import {computed} from "vue";
9+
import {diffClass, formatPercentChange} from "../shared";
10+
import Tooltip from "../tooltip.vue";
811
912
const props = defineProps<{
1013
cases: TestCaseComparison<CompileTestCase>[];
@@ -24,6 +27,13 @@ function calculateSummary(
2427
}
2528
2629
const opened = createPersistedRef(PREF_AGGREGATIONS_OPENED);
30+
31+
const totalBefore = computed(() =>
32+
props.cases.map((c) => c.datumA).reduce((acc, v) => acc + v, 0)
33+
);
34+
const totalAfter = computed(() =>
35+
props.cases.map((c) => c.datumB).reduce((acc, v) => acc + v, 0)
36+
);
2737
</script>
2838

2939
<template>
@@ -32,6 +42,17 @@ const opened = createPersistedRef(PREF_AGGREGATIONS_OPENED);
3242
<template #label>Aggregations</template>
3343
<template #content>
3444
<div>
45+
<div>
46+
Total accumulated change:
47+
<span :class="diffClass(totalAfter - totalBefore)">
48+
{{ formatPercentChange(totalBefore, totalAfter) }}</span
49+
>
50+
<Tooltip style="margin-left: 1em">
51+
The total accumulated change in the measured metric across all
52+
visible benchmarks. Computed by summing the value of the metric
53+
for all visible benchmarks and comparing the before/after sum.
54+
</Tooltip>
55+
</div>
3556
<div class="aggregation-section">
3657
<div class="header">Profile</div>
3758
<div class="groups">

0 commit comments

Comments
 (0)