Skip to content

Commit cbda727

Browse files
committed
Show io timings in the Grid view
Fixes dalibo#706 Some css rules have been added to separate group headers. Better but still not perfect.
1 parent 6114c97 commit cbda727

3 files changed

Lines changed: 94 additions & 2 deletions

File tree

src/components/Grid.vue

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@ const hasTime = computed((): boolean => {
6464
})
6565
})
6666
67+
const hasIORead = computed((): boolean => {
68+
return _.some(plans, (plan: Row[]) => {
69+
return _.some(plan, (row: Row) => {
70+
return row[1][NodeProp.IO_READ_TIME] || 0 > 1
71+
})
72+
})
73+
})
74+
75+
const hasIOWrite = computed((): boolean => {
76+
return _.some(plans, (plan: Row[]) => {
77+
return _.some(plan, (row: Row) => {
78+
return row[1][NodeProp.IO_WRITE_TIME] || 0 > 1
79+
})
80+
})
81+
})
82+
83+
const hasIO = computed((): boolean => {
84+
return hasIORead.value || hasIOWrite.value
85+
})
86+
87+
const ioColumns = computed((): number => {
88+
return _.filter([hasIORead.value, hasIOWrite.value], (v) => v).length
89+
})
90+
6791
const hasRows = computed((): boolean => {
6892
return _.some(plans, (plan: Row[]) => {
6993
return _.some(plan, (row: Row) => {
@@ -290,8 +314,12 @@ const columns = computed(() => {
290314
<div>
291315
<table class="table table-sm table-hover">
292316
<thead class="table-secondary sticky-top" style="z-index: 2">
293-
<tr v-if="columnsRight.length > 0">
294-
<th :colspan="2 + columnsLeft.length"></th>
317+
<tr v-if="hasIO || columnsRight.length > 0" class="table-group">
318+
<th colspan="2">
319+
<!-- id & time -->
320+
</th>
321+
<th class="text-center" :colspan="ioColumns" v-if="hasIO">io</th>
322+
<th :colspan="columnsLeft.length"></th>
295323
<th
296324
class="text-center"
297325
:colspan="sharedBlocksColumns"
@@ -317,6 +345,8 @@ const columns = computed(() => {
317345
<tr>
318346
<th class="text-center"></th>
319347
<th class="text-center" v-if="hasTime">time</th>
348+
<th class="text-center" v-if="hasIORead">read</th>
349+
<th class="text-center" v-if="hasIOWrite">write</th>
320350
<th class="text-center" v-if="hasRows">rows</th>
321351
<th class="text-center" v-if="hasEstimation">estim</th>
322352
<th class="text-center" v-if="hasCost">cost</th>
@@ -371,3 +401,21 @@ const columns = computed(() => {
371401
</table>
372402
</div>
373403
</template>
404+
405+
<style scoped>
406+
table {
407+
thead tr.table-group {
408+
th {
409+
border-left: 1px solid #b5b6b7;
410+
border-bottom: 0;
411+
}
412+
/*
413+
* This targets the second empty cell in a pair
414+
* and avoids border between 2 empty cells
415+
*/
416+
th:empty + th:empty {
417+
border-left: 0;
418+
}
419+
}
420+
}
421+
</style>

src/components/GridRow.vue

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
formatNodeProp,
1414
keysToString,
1515
sortKeys,
16+
transferRate,
1617
} from "@/filters"
1718
import LevelDivider from "@/components/LevelDivider.vue"
1819
import GridProgressBar from "@/components/GridProgressBar.vue"
@@ -54,6 +55,7 @@ const {
5455
executionTimePercent,
5556
heapFetchesClass,
5657
heapFetchesTooltip,
58+
ioTooltip,
5759
localDirtiedPercent,
5860
localHitPercent,
5961
localReadPercent,
@@ -132,6 +134,46 @@ function formattedProp(propName: keyof typeof NodeProp) {
132134
</template>
133135
</div>
134136
</td>
137+
<td
138+
class="text-end grid-progress-cell text-nowrap"
139+
v-if="node[NodeProp.IO_READ_TIME]"
140+
v-tippy="{ content: ioTooltip, allowHTML: true }"
141+
>
142+
<GridProgressBar
143+
:percentage="
144+
(node[NodeProp.EXCLUSIVE_IO_READ_TIME] /
145+
(plan.content.Plan[NodeProp.IO_READ_TIME] +
146+
plan.content.Plan[NodeProp.IO_WRITE_TIME])) *
147+
100
148+
"
149+
></GridProgressBar>
150+
{{ Math.round(node[NodeProp.EXCLUSIVE_IO_READ_TIME]).toLocaleString() }}
151+
<div v-if="showDetails" class="small text-body-secondary">
152+
{{ duration(node[NodeProp.EXCLUSIVE_IO_READ_TIME]) }}
153+
<br />
154+
{{ transferRate(node[NodeProp.AVERAGE_IO_READ_SPEED]) }}
155+
</div>
156+
</td>
157+
<td
158+
class="text-end grid-progress-cell text-nowrap"
159+
v-if="node[NodeProp.IO_WRITE_TIME]"
160+
v-tippy="{ content: ioTooltip, allowHTML: true }"
161+
>
162+
<GridProgressBar
163+
:percentage="
164+
(node[NodeProp.EXCLUSIVE_IO_WRITE_TIME] /
165+
(plan.content.Plan[NodeProp.IO_READ_TIME] +
166+
plan.content.Plan[NodeProp.IO_WRITE_TIME])) *
167+
100
168+
"
169+
></GridProgressBar>
170+
{{ Math.round(node[NodeProp.EXCLUSIVE_IO_WRITE_TIME]).toLocaleString() }}
171+
<div v-if="showDetails" class="small text-body-secondary">
172+
{{ duration(node[NodeProp.EXCLUSIVE_IO_WRITE_TIME]) }}
173+
<br />
174+
{{ transferRate(node[NodeProp.AVERAGE_IO_WRITE_SPEED]) }}
175+
</div>
176+
</td>
135177
<td
136178
class="text-end grid-progress-cell text-nowrap"
137179
v-if="columns.includes('rows')"

src/interfaces.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ export class Node {
112112
[NodeProp.EXCLUSIVE_IO_WRITE_TIME]!: number;
113113
[NodeProp.AVERAGE_IO_READ_SPEED]!: number;
114114
[NodeProp.AVERAGE_IO_WRITE_SPEED]!: number;
115+
[NodeProp.IO_READ_TIME]!: number;
116+
[NodeProp.IO_WRITE_TIME]!: number;
115117
[k: string]:
116118
| Node[]
117119
| Options

0 commit comments

Comments
 (0)