Skip to content

Commit a90edbf

Browse files
committed
Add per function stats table in Stats tab
1 parent e2ae0d1 commit a90edbf

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

src/components/Stats.vue

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ const perTable = computed(() => {
5656
return values
5757
})
5858
59+
const perFunction = computed(() => {
60+
const functions: { [key: string]: Node[] } = _.groupBy(
61+
_.filter(nodes, (n) => n[NodeProp.FUNCTION_NAME] !== undefined),
62+
NodeProp.FUNCTION_NAME
63+
)
64+
const values: StatsTableItemType[] = []
65+
_.each(functions, (nodes, functionName) => {
66+
values.push({
67+
name: functionName,
68+
count: nodes.length,
69+
time: _.sumBy(nodes, NodeProp.EXCLUSIVE_DURATION),
70+
timePercent: durationPercent(nodes),
71+
nodes,
72+
})
73+
})
74+
return values
75+
})
76+
5977
const perNodeType = computed(() => {
6078
const nodeTypes: { [key: string]: Node[] } = _.groupBy(
6179
nodes,
@@ -129,6 +147,40 @@ const perIndex = computed(() => {
129147
</tr>
130148
</tbody>
131149
</sorted-table>
150+
<h6 class="mt-2">Per function stats</h6>
151+
<sorted-table
152+
class="table table-nonfluid table-sm table-bordered"
153+
:values="perFunction"
154+
sort="time"
155+
:dir="SortDirection.desc"
156+
>
157+
<thead class="table-secondary">
158+
<tr>
159+
<th scope="col">
160+
<sort-link name="name">Function</sort-link>
161+
</th>
162+
<th scope="col" class="text-end">
163+
<sort-link name="count">Count</sort-link>
164+
</th>
165+
<th scope="col" colspan="2" class="text-end">
166+
<sort-link name="time">Time</sort-link>
167+
</th>
168+
</tr>
169+
</thead>
170+
<template v-slot:body="sort">
171+
<template v-for="value in sort.values" :key="value">
172+
<stats-table-item
173+
:value="value as StatsTableItemType"
174+
:executionTime="executionTime"
175+
></stats-table-item>
176+
</template>
177+
</template>
178+
<tbody v-if="!perFunction.length">
179+
<tr>
180+
<td colspan="3" class="text-center fst-italic">No function used</td>
181+
</tr>
182+
</tbody>
183+
</sorted-table>
132184
<h6>Per node type stats</h6>
133185
<sorted-table
134186
class="table table-nonfluid table-sm table-bordered"

0 commit comments

Comments
 (0)