@@ -13,11 +13,13 @@ import {GraphRenderOpts, renderPlots} from "../../../../graph/render";
13
13
import {GRAPH_RESOLVER } from " ../../../../graph/resolver" ;
14
14
import {GraphKind } from " ../../../../graph/data" ;
15
15
import uPlot from " uplot" ;
16
+ import CachegrindCmd from " ../../../../components/cachegrind-cmd.vue" ;
16
17
17
18
const props = defineProps <{
18
19
testCase: CompileTestCase ;
19
20
metric: string ;
20
21
artifact: ArtifactDescription ;
22
+ baseArtifact: ArtifactDescription ;
21
23
benchmarkMap: CompileBenchmarkMap ;
22
24
}>();
23
25
@@ -128,6 +130,34 @@ function getGraphTitle() {
128
130
}
129
131
}
130
132
133
+ function benchmarkLink(benchmark : string ): string {
134
+ return ` https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/${benchmark } ` ;
135
+ }
136
+
137
+ function detailedQueryLink(
138
+ commit : ArtifactDescription ,
139
+ baseCommit ? : ArtifactDescription
140
+ ): string {
141
+ const {benchmark, profile, scenario} = props .testCase ;
142
+ let link = ` /detailed-query.html?commit=${commit .commit }&benchmark=${benchmark }-${profile }&scenario=${scenario } ` ;
143
+ if (baseCommit !== undefined ) {
144
+ link += ` &base_commit=${baseCommit .commit } ` ;
145
+ }
146
+ return link ;
147
+ }
148
+
149
+ function graphLink(
150
+ commit : ArtifactDescription ,
151
+ metric : string ,
152
+ testCase : CompileTestCase
153
+ ): string {
154
+ // Move to `30 days ago` to display history of the test case
155
+ const start = getPastDate (new Date (commit .date ), 30 );
156
+ const end = commit .commit ;
157
+ const {benchmark, profile, scenario} = testCase ;
158
+ return ` /index.html?start=${start }&end=${end }&benchmark=${benchmark }&profile=${profile }&scenario=${scenario }&stat=${metric } ` ;
159
+ }
160
+
131
161
const metadata = computed (
132
162
(): CompileBenchmarkMetadata =>
133
163
props .benchmarkMap [props .testCase .benchmark ] ?? null
@@ -149,88 +179,209 @@ const cargoProfile = computed((): CargoProfileMetadata => {
149
179
const chartElement: Ref <HTMLElement | null > = ref (null );
150
180
const graphRange = computed (() => getGraphRange (props .artifact ));
151
181
182
+ enum ProfileCommand {
183
+ Before = " before" ,
184
+ After = " after" ,
185
+ Diff = " diff" ,
186
+ }
187
+
188
+ const profileCommand: Ref <ProfileCommand > = ref (ProfileCommand .Diff );
189
+ const profileCommit = computed (() => {
190
+ if (profileCommand .value === ProfileCommand .Before ) {
191
+ return props .baseArtifact .commit ;
192
+ }
193
+ return props .artifact .commit ;
194
+ });
195
+ const profileBaselineCommit = computed (() => {
196
+ if (profileCommand .value === ProfileCommand .Diff ) {
197
+ return props .baseArtifact .commit ;
198
+ }
199
+ return undefined ;
200
+ });
201
+
202
+ function changeProfileCommand(event : Event ) {
203
+ const target = event .target as HTMLSelectElement ;
204
+ profileCommand .value = target .value as ProfileCommand ;
205
+ }
206
+
152
207
onMounted (() => renderGraph ());
153
208
</script >
154
209
155
210
<template >
156
- <div class =" wrapper" >
157
- <div >
158
- <div class =" title info bold" >Benchmark info</div >
159
- <table >
160
- <tbody >
161
- <tr >
162
- <td >Benchmark</td >
163
- <td >{{ testCase.benchmark }}</td >
164
- </tr >
165
- <tr >
166
- <td >Profile</td >
167
- <td >{{ testCase.profile }}</td >
168
- </tr >
169
- <tr >
170
- <td >Scenario</td >
171
- <td >{{ testCase.scenario }}</td >
172
- </tr >
173
- <tr >
174
- <td >Category</td >
175
- <td >{{ testCase.category }}</td >
176
- </tr >
177
- <tr v-if =" (metadata?.binary ?? null) !== null" >
178
- <td >Artifact</td >
179
- <td >{{ metadata.binary ? "binary" : "library" }}</td >
180
- </tr >
181
- <tr v-if =" (metadata?.iterations ?? null) !== null" >
182
- <td >
183
- Iterations<Tooltip >
184
- How many times is the benchmark executed?
185
- </Tooltip >
186
- </td >
187
- <td >{{ metadata.iterations }}</td >
188
- </tr >
189
- <tr v-if =" (cargoProfile?.lto ?? null) !== null" >
190
- <td >LTO</td >
191
- <td >{{ cargoProfile.lto }}</td >
192
- </tr >
193
- <tr v-if =" (cargoProfile?.debug ?? null) !== null" >
194
- <td >Debuginfo</td >
195
- <td >{{ cargoProfile.debug }}</td >
196
- </tr >
197
- <tr v-if =" (cargoProfile?.codegen_units ?? null) !== null" >
198
- <td >Codegen units</td >
199
- <td >{{ cargoProfile.codegen_units }}</td >
200
- </tr >
201
- </tbody >
202
- </table >
203
- </div >
204
- <div >
205
- <div class =" title" >
206
- <div class =" bold" >{{ getGraphTitle() }}</div >
207
- <div style =" font-size : 0.8em " >
208
- Each plotted value is relative to its previous commit
211
+ <div >
212
+ <div class =" columns" >
213
+ <div class =" rows grow" >
214
+ <div >
215
+ <div class =" title info bold" >Benchmark info</div >
216
+ <table >
217
+ <tbody >
218
+ <tr >
219
+ <td >Benchmark</td >
220
+ <td >{{ testCase.benchmark }}</td >
221
+ </tr >
222
+ <tr >
223
+ <td >Profile</td >
224
+ <td >{{ testCase.profile }}</td >
225
+ </tr >
226
+ <tr >
227
+ <td >Scenario</td >
228
+ <td >{{ testCase.scenario }}</td >
229
+ </tr >
230
+ <tr >
231
+ <td >Category</td >
232
+ <td >{{ testCase.category }}</td >
233
+ </tr >
234
+ <tr v-if =" (metadata?.binary ?? null) !== null" >
235
+ <td >Artifact</td >
236
+ <td >{{ metadata.binary ? "binary" : "library" }}</td >
237
+ </tr >
238
+ <tr v-if =" (metadata?.iterations ?? null) !== null" >
239
+ <td >
240
+ Iterations
241
+ <Tooltip > How many times is the benchmark executed? </Tooltip >
242
+ </td >
243
+ <td >{{ metadata.iterations }}</td >
244
+ </tr >
245
+ <tr v-if =" (cargoProfile?.lto ?? null) !== null" >
246
+ <td >LTO</td >
247
+ <td >{{ cargoProfile.lto }}</td >
248
+ </tr >
249
+ <tr v-if =" (cargoProfile?.debug ?? null) !== null" >
250
+ <td >Debuginfo</td >
251
+ <td >{{ cargoProfile.debug }}</td >
252
+ </tr >
253
+ <tr v-if =" (cargoProfile?.codegen_units ?? null) !== null" >
254
+ <td >Codegen units</td >
255
+ <td >{{ cargoProfile.codegen_units }}</td >
256
+ </tr >
257
+ </tbody >
258
+ </table >
209
259
</div >
210
- <div style =" font-size : 0.8em " >
211
- The shaded region shows values that are more recent than the
212
- benchmarked commit
260
+ <div class =" links" >
261
+ <div class =" title bold" >Links</div >
262
+ <ul >
263
+ <li >
264
+ <a
265
+ :href =" detailedQueryLink(props.artifact, props.baseArtifact)"
266
+ target =" _blank"
267
+ >
268
+ Detailed results
269
+ </a >
270
+ </li >
271
+ <li >
272
+ <a
273
+ :href =" graphLink(props.artifact, props.metric, props.testCase)"
274
+ target =" _blank"
275
+ >
276
+ History graph
277
+ </a >
278
+ </li >
279
+ <li >
280
+ <a :href =" detailedQueryLink(props.baseArtifact)" target =" _blank" >
281
+ Rustc self-profile: baseline commit
282
+ </a >
283
+ </li >
284
+ <li >
285
+ <a :href =" detailedQueryLink(props.artifact)" target =" _blank" >
286
+ Rustc self-profile: benchmarked commit
287
+ </a >
288
+ </li >
289
+ <li >
290
+ <a :href =" benchmarkLink(testCase.benchmark)" target =" _blank" >
291
+ Benchmark source code
292
+ </a >
293
+ </li >
294
+ </ul >
295
+ </div >
296
+ </div >
297
+ <div class =" rows center-items grow" >
298
+ <div class =" title" >
299
+ <div class =" bold" >{{ getGraphTitle() }}</div >
300
+ <div style =" font-size : 0.8em " >
301
+ Each plotted value is relative to its previous commit
302
+ </div >
303
+ <div style =" font-size : 0.8em " >
304
+ The shaded region shows values that are more recent than the
305
+ benchmarked commit
306
+ </div >
213
307
</div >
308
+ <div ref =" chartElement" ></div >
214
309
</div >
215
- <div ref =" chartElement" ></div >
310
+ </div >
311
+ <div class =" command" >
312
+ <div class =" title bold" >
313
+ Local profiling command<Tooltip >
314
+ Execute this command in a checkout of
315
+ <a href =" https://github.com/rust-lang/rustc-perf" >rustc-perf</a >
316
+ to generate a Cachegrind profile.
317
+ </Tooltip >
318
+ </div >
319
+
320
+ <select @change =" changeProfileCommand" >
321
+ <option
322
+ :value =" ProfileCommand.Diff"
323
+ :selected =" profileCommand === ProfileCommand.Diff"
324
+ >
325
+ Diff
326
+ </option >
327
+ <option
328
+ :value =" ProfileCommand.Before"
329
+ :selected =" profileCommand === ProfileCommand.Before"
330
+ >
331
+ Baseline commit
332
+ </option >
333
+ <option
334
+ :value =" ProfileCommand.After"
335
+ :selected =" profileCommand === ProfileCommand.After"
336
+ >
337
+ Benchmarked commit
338
+ </option >
339
+ </select >
340
+
341
+ <CachegrindCmd
342
+ :commit =" profileCommit"
343
+ :baseline-commit =" profileBaselineCommit"
344
+ :test-case =" testCase"
345
+ />
216
346
</div >
217
347
</div >
218
348
</template >
219
349
220
350
<style scoped lang="scss">
221
- .wrapper {
351
+ .columns {
222
352
display : flex ;
353
+ flex-wrap : wrap ;
354
+ gap : 15px ;
223
355
margin : 10px 0 ;
356
+
357
+ .grow {
358
+ flex-grow : 1 ;
359
+ }
360
+ }
361
+ .rows {
362
+ display : flex ;
363
+ flex-direction : column ;
364
+ gap : 15px ;
365
+
366
+ & .center-items {
367
+ align-items : center ;
368
+ }
369
+ }
370
+ .command {
371
+ text-align : left ;
224
372
}
373
+
225
374
.title {
226
375
& .bold ,
227
376
.bold {
228
377
font-weight : bold ;
229
378
}
379
+
230
380
& .info {
231
381
margin-bottom : 15px ;
232
382
}
233
383
}
384
+
234
385
table {
235
386
align-self : flex-start ;
236
387
margin-right : 20px ;
@@ -244,6 +395,12 @@ table {
244
395
}
245
396
}
246
397
}
398
+
399
+ .links {
400
+ li {
401
+ text-align : left ;
402
+ }
403
+ }
247
404
</style >
248
405
249
406
<style >
0 commit comments