Skip to content

Commit c077e58

Browse files
committed
Add query cache hits
1 parent 416d3e3 commit c077e58

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

site/frontend/src/pages/detailed-query/page.vue

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
createTableData,
1313
createArtifactData,
1414
DeltaData,
15+
TableRowData,
1516
} from "./utils";
1617
1718
const loading = ref(true);
@@ -76,6 +77,15 @@ const tableData = computed(() => {
7677
? Math.abs(b.executionsDelta.percentage)
7778
: 0;
7879
break;
80+
case "cacheHits": // Hits
81+
aValue = a.cacheHits;
82+
bValue = b.cacheHits;
83+
// Use percentage change as secondary sort for equal absolute values
84+
aSecondary =
85+
a.cacheHitsDelta !== null ? Math.abs(a.cacheHitsDelta.percentage) : 0;
86+
bSecondary =
87+
b.cacheHitsDelta !== null ? Math.abs(b.cacheHitsDelta.percentage) : 0;
88+
break;
7989
case "incrementalLoading": // Incremental loading (s)
8090
aValue = a.incrementalLoading;
8191
bValue = b.incrementalLoading;
@@ -117,6 +127,15 @@ const tableData = computed(() => {
117127
? Math.abs(b.executionsDelta.percentage)
118128
: 0;
119129
break;
130+
case "cacheHitsDelta": // Cache hits delta
131+
aValue = a.cacheHitsDelta !== null ? a.cacheHitsDelta.delta : -Infinity;
132+
bValue = b.cacheHitsDelta !== null ? b.cacheHitsDelta.delta : -Infinity;
133+
// Use percentage as secondary sort for equal delta values
134+
aSecondary =
135+
a.cacheHitsDelta !== null ? Math.abs(a.cacheHitsDelta.percentage) : 0;
136+
bSecondary =
137+
b.cacheHitsDelta !== null ? Math.abs(b.cacheHitsDelta.percentage) : 0;
138+
break;
120139
case "incrementalLoadingDelta": // Incremental loading delta
121140
aValue =
122141
a.incrementalLoadingDelta !== null
@@ -204,6 +223,7 @@ async function loadData() {
204223
base_commit: base_commit ?? null,
205224
benchmark,
206225
scenario,
226+
sort_idx: "-2",
207227
};
208228
selector.value = currentSelector;
209229
@@ -440,6 +460,20 @@ loadData();
440460
>Executions delta</a
441461
>
442462
</th>
463+
<th :class="getHeaderClass('cacheHits')">
464+
<a
465+
href="#"
466+
@click.prevent="changeSortParameters('cacheHits', 'desc')"
467+
>Hits</a
468+
>
469+
</th>
470+
<th v-if="showDelta" :class="getHeaderClass('cacheHitsDelta')">
471+
<a
472+
href="#"
473+
@click.prevent="changeSortParameters('cacheHitsDelta', 'desc')"
474+
>Hits delta</a
475+
>
476+
</th>
443477
<th
444478
v-if="showIncr"
445479
:class="getHeaderClass('incrementalLoading')"
@@ -485,6 +519,10 @@ loadData();
485519
<td v-if="showDelta">
486520
<DeltaComponent :delta="row.executionsDelta" />
487521
</td>
522+
<td>{{ row.cacheHits }}</td>
523+
<td v-if="showDelta">
524+
<DeltaComponent :delta="row.cacheHitsDelta" />
525+
</td>
488526
<td v-if="showIncr">{{ row.incrementalLoading.toFixed(3) }}</td>
489527
<td v-if="showDelta && showIncr">
490528
<DeltaComponent :delta="row.incrementalLoadingDelta" />

site/frontend/src/pages/detailed-query/utils.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ export interface TableRowData {
242242
timeDelta: DeltaData | null;
243243
executions: number;
244244
executionsDelta: DeltaData | null;
245+
cacheHits: number;
246+
cacheHitsDelta: DeltaData | null;
245247
incrementalLoading: number;
246248
incrementalLoadingDelta: DeltaData | null;
247249
}
@@ -300,6 +302,14 @@ function createRowData(
300302
executionsDelta: delta
301303
? createDelta(value.invocation_count, delta.invocation_count, true)
302304
: null,
305+
cacheHits: value.number_of_cache_hits,
306+
cacheHitsDelta: delta
307+
? createDelta(
308+
value.number_of_cache_hits,
309+
delta.number_of_cache_hits,
310+
true
311+
)
312+
: null,
303313
incrementalLoading: toSeconds(value.incremental_load_time),
304314
incrementalLoadingDelta: delta
305315
? createDelta(

0 commit comments

Comments
 (0)