@@ -179,6 +179,31 @@ const cargoProfile = computed((): CargoProfileMetadata => {
179179const chartElement: Ref <HTMLElement | null > = ref (null );
180180const graphRange = computed (() => getGraphRange (props .artifact ));
181181
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+
182207onMounted (() => renderGraph ());
183208 </script >
184209
@@ -288,12 +313,34 @@ onMounted(() => renderGraph());
288313 Local profiling command<Tooltip >
289314 Execute this command in a checkout of
290315 <a href =" https://github.com/rust-lang/rustc-perf" >rustc-perf</a >
291- to generate a Cachegrind diff between the two artifacts .
316+ to generate a Cachegrind profile .
292317 </Tooltip >
293318 </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+
294341 <CachegrindCmd
295- :commit =" artifact.commit "
296- :baseline_commit = " baseArtifact.commit "
342+ :commit =" profileCommit "
343+ :baseline-commit = " profileBaselineCommit "
297344 :test-case =" testCase"
298345 />
299346 </div >
0 commit comments