Skip to content

Commit 31f3cd8

Browse files
Print out cachegrind diff path post-generation
Otherwise, users need to manually assemble the path, which can be a little annoying (particularly with long commit hashes).
1 parent 5907579 commit 31f3cd8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

collector/src/main.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,8 @@ fn generate_cachegrind_diffs(
515515
profile_kinds: &[ProfileKind],
516516
scenario_kinds: &[ScenarioKind],
517517
errors: &mut BenchmarkErrors,
518-
) {
518+
) -> Vec<PathBuf> {
519+
let mut annotated_diffs = Vec::new();
519520
for benchmark in benchmarks {
520521
for &profile_kind in profile_kinds {
521522
for &scenario_kind in scenario_kinds {
@@ -559,9 +560,12 @@ fn generate_cachegrind_diffs(
559560
eprintln!("collector error: {:?}", e);
560561
continue;
561562
}
563+
564+
annotated_diffs.push(cgann);
562565
}
563566
}
564567
}
568+
annotated_diffs
565569
}
566570

567571
/// Demangles symbols in a file using rustfilt and writes result to path.
@@ -1065,7 +1069,7 @@ fn main_result() -> anyhow::Result<i32> {
10651069
}
10661070

10671071
if let Profiler::Cachegrind = profiler {
1068-
generate_cachegrind_diffs(
1072+
let diffs = generate_cachegrind_diffs(
10691073
id1,
10701074
id2,
10711075
&out_dir,
@@ -1074,6 +1078,14 @@ fn main_result() -> anyhow::Result<i32> {
10741078
&scenario_kinds,
10751079
&mut errors,
10761080
);
1081+
if diffs.len() > 1 {
1082+
eprintln!("Diffs:");
1083+
for diff in diffs {
1084+
eprintln!("{}", diff.to_string_lossy());
1085+
}
1086+
} else if diffs.len() == 1 {
1087+
eprintln!("Diff: {}", diffs[0].to_string_lossy());
1088+
}
10771089
}
10781090

10791091
errors.fail_if_nonzero()?;

0 commit comments

Comments
 (0)