Skip to content

Commit d539f2b

Browse files
Merge pull request #1082 from Mark-Simulacrum/diff-paths
Print out paths for auto-generated cgdiff results
2 parents 5907579 + f2c266d commit d539f2b

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

collector/src/main.rs

Lines changed: 17 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,17 @@ 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+
let short = out_dir.join("cgdiffann-latest");
1088+
std::fs::copy(&diffs[0], &short).expect("copy to short path");
1089+
eprintln!("Original diff at: {}", diffs[0].to_string_lossy());
1090+
eprintln!("Short path: {}", short.to_string_lossy());
1091+
}
10771092
}
10781093

10791094
errors.fail_if_nonzero()?;

0 commit comments

Comments
 (0)