@@ -13,7 +13,15 @@ import {GraphRenderOpts, renderPlots} from "../../../../graph/render";
13
13
import {GraphData , GraphKind , GraphsSelector } from " ../../../../graph/data" ;
14
14
import uPlot from " uplot" ;
15
15
import CachegrindCmd from " ../../../../components/cachegrind-cmd.vue" ;
16
- import {COMPILE_DETAIL_GRAPHS_RESOLVER } from " ./detail-resolver" ;
16
+ import {
17
+ COMPILE_DETAIL_GRAPHS_RESOLVER ,
18
+ COMPILE_DETAIL_SECTIONS_RESOLVER ,
19
+ CompileDetailGraphs ,
20
+ CompileDetailGraphsSelector ,
21
+ CompileDetailSections ,
22
+ CompileDetailSectionsSelector ,
23
+ } from " ./detail-resolver" ;
24
+ import CompileSectionsChart from " ./sections-chart.vue" ;
17
25
import PerfettoLink from " ../../../../components/perfetto-link.vue" ;
18
26
19
27
const props = defineProps <{
@@ -97,10 +105,9 @@ function drawCurrentDate(opts: GraphRenderOpts, date: Date) {
97
105
};
98
106
}
99
107
100
- // Render both relative and absolute graphs
101
- async function renderGraphs() {
102
- const {start, end, date} = graphRange .value ;
103
- const selector = {
108
+ function createGraphsSelector(): CompileDetailGraphsSelector {
109
+ const {start, end} = graphRange .value ;
110
+ return {
104
111
benchmark: props .testCase .benchmark ,
105
112
profile: props .testCase .profile ,
106
113
scenario: props .testCase .scenario ,
@@ -109,8 +116,31 @@ async function renderGraphs() {
109
116
end ,
110
117
kinds: [" percentrelative" , " raw" ] as GraphKind [],
111
118
};
112
- const graphsDetail = await COMPILE_DETAIL_GRAPHS_RESOLVER .load (selector );
113
- if (graphsDetail .commits .length === 0 ) {
119
+ }
120
+
121
+ async function loadGraphs(): Promise <CompileDetailGraphs > {
122
+ return await COMPILE_DETAIL_GRAPHS_RESOLVER .load (createGraphsSelector ());
123
+ }
124
+
125
+ function createSectionsSelector(): CompileDetailSectionsSelector {
126
+ return {
127
+ benchmark: props .testCase .benchmark ,
128
+ profile: props .testCase .profile ,
129
+ scenario: props .testCase .scenario ,
130
+ start: props .baseArtifact .commit ,
131
+ end: props .artifact .commit ,
132
+ };
133
+ }
134
+
135
+ async function loadSections(): Promise <CompileDetailSections > {
136
+ return await COMPILE_DETAIL_SECTIONS_RESOLVER .load (createSectionsSelector ());
137
+ }
138
+
139
+ // Render both relative and absolute graphs
140
+ async function renderGraphs(detail : CompileDetailGraphs ) {
141
+ const selector = createGraphsSelector ();
142
+ const date = graphRange .value .date ;
143
+ if (detail .commits .length === 0 ) {
114
144
return ;
115
145
}
116
146
@@ -119,13 +149,13 @@ async function renderGraphs() {
119
149
kind : GraphKind
120
150
): [GraphData , GraphsSelector ] {
121
151
const data = {
122
- commits: graphsDetail .commits ,
152
+ commits: detail .commits ,
123
153
benchmarks: {
124
154
[selector .benchmark ]: {
125
155
// The server returns profiles capitalized, so we need to match that
126
156
// here, so that the graph code can find the expected profile.
127
157
[capitalize (selector .profile )]: {
128
- [selector .scenario ]: graphsDetail .graphs [index ],
158
+ [selector .scenario ]: detail .graphs [index ],
129
159
},
130
160
},
131
161
},
@@ -264,7 +294,15 @@ function changeProfileCommand(event: Event) {
264
294
profileCommand .value = target .value as ProfileCommand ;
265
295
}
266
296
267
- onMounted (() => renderGraphs ());
297
+ const sectionsDetail: Ref <CompileDetailSections | null > = ref (null );
298
+ onMounted (() => {
299
+ loadGraphs ().then ((d ) => {
300
+ renderGraphs (d );
301
+ });
302
+ loadSections ().then ((d ) => {
303
+ sectionsDetail .value = d ;
304
+ });
305
+ });
268
306
</script >
269
307
270
308
<template >
@@ -297,7 +335,7 @@ onMounted(() => renderGraphs());
297
335
<tr v-if =" (metadata?.iterations ?? null) !== null" >
298
336
<td >
299
337
Iterations
300
- <Tooltip > How many times is the benchmark executed? </Tooltip >
338
+ <Tooltip > How many times is the benchmark executed?</Tooltip >
301
339
</td >
302
340
<td >{{ metadata.iterations }}</td >
303
341
</tr >
@@ -391,6 +429,32 @@ onMounted(() => renderGraphs());
391
429
<div ref =" relativeChartElement" ></div >
392
430
</div >
393
431
</div >
432
+ <div class =" columns" >
433
+ <div class =" rows grow" >
434
+ <div class =" title bold" >
435
+ Sections
436
+ <Tooltip
437
+ >Percentual duration of individual compilation sections. This is a
438
+ rough estimate that might not necessarily contain all of the
439
+ individual parts of the compilation. The sections are calculated
440
+ based on the results of self-profile queries and they are measured
441
+ based on wall-time.
442
+ </Tooltip >
443
+ </div >
444
+ <div >
445
+ <CompileSectionsChart
446
+ v-if ="
447
+ (sectionsDetail?.before ?? null) !== null &&
448
+ (sectionsDetail?.after ?? null) !== null
449
+ "
450
+ :before =" sectionsDetail.before"
451
+ :after =" sectionsDetail.after"
452
+ />
453
+ <span v-else-if =" sectionsDetail === null" >Loading…</span >
454
+ <span v-else >Not available</span >
455
+ </div >
456
+ </div >
457
+ </div >
394
458
<div class =" command" >
395
459
<div class =" title bold" >
396
460
Local profiling command<Tooltip >
0 commit comments