Skip to content

Commit 90118b8

Browse files
committed
Generate cachegrind diff for runtime benchmarks
1 parent edd113e commit 90118b8

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

collector/src/bin/collector.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,14 +665,22 @@ fn main_result() -> anyhow::Result<i32> {
665665

666666
println!("Profiling {rustc}");
667667
let (toolchain1, suite1) = get_suite(&rustc, "1")?;
668-
let profile1 = profile_runtime(profiler.clone(), toolchain1, suite1, &benchmark)?;
668+
let profile1 = profile_runtime(profiler.clone(), &toolchain1, suite1, &benchmark)?;
669669

670670
if let Some(rustc2) = rustc2 {
671671
match profiler {
672672
RuntimeProfiler::Cachegrind => {
673673
println!("Profiling {rustc2}");
674674
let (toolchain2, suite2) = get_suite(&rustc2, "2")?;
675-
let profile2 = profile_runtime(profiler, toolchain2, suite2, &benchmark)?;
675+
let profile2 = profile_runtime(profiler, &toolchain2, suite2, &benchmark)?;
676+
677+
let output = profile1.parent().unwrap().join(format!(
678+
"cgann-diff-{}-{}-{benchmark}",
679+
toolchain1.id, toolchain2.id
680+
));
681+
cachegrind_diff(&profile1, &profile2, &output)
682+
.context("Cannot generate Cachegrind diff")?;
683+
println!("Cachegrind diff stored in `{}`", output.display());
676684
}
677685
}
678686
} else {

collector/src/runtime/profile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub enum RuntimeProfiler {
1717
/// Profiles a single runtime benchmark and returns a path to the result.
1818
pub fn profile_runtime(
1919
profiler: RuntimeProfiler,
20-
toolchain: Toolchain,
20+
toolchain: &Toolchain,
2121
suite: BenchmarkSuite,
2222
benchmark: &str,
2323
) -> anyhow::Result<PathBuf> {

0 commit comments

Comments
 (0)