Skip to content

Commit 7791f6d

Browse files
Only collect self profile if summarize is found
1 parent b5f88a6 commit 7791f6d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

collector/src/bin/rustc-perf-collector/execute.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,12 @@ pub struct MeasureProcessor {
312312
patched_incr_stats: Vec<(Patch, (Stats, Option<SelfProfile>))>,
313313

314314
collecting_self_profile: bool,
315+
316+
should_collect_self_profile: bool,
315317
}
316318

317319
impl MeasureProcessor {
318-
pub fn new() -> Self {
320+
pub fn new(collect_self_profile: bool) -> Self {
319321
// Check we have `perf` available.
320322
let has_perf = Command::new("perf").output().is_ok();
321323
assert!(has_perf);
@@ -326,13 +328,15 @@ impl MeasureProcessor {
326328
clean_incr_stats: (Stats::new(), None),
327329
patched_incr_stats: Vec::new(),
328330
collecting_self_profile: true,
331+
// Command::new("summarize").status().is_ok()
332+
should_collect_self_profile: collect_self_profile,
329333
}
330334
}
331335
}
332336

333337
impl Processor for MeasureProcessor {
334338
fn profiler(&self) -> Profiler {
335-
if self.collecting_self_profile {
339+
if self.collecting_self_profile && self.should_collect_self_profile {
336340
Profiler::PerfStatSelfProfile
337341
} else {
338342
Profiler::PerfStat

collector/src/bin/rustc-perf-collector/main.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use std::fs;
1919
use std::io::{stderr, Write};
2020
use std::path::{Path, PathBuf};
2121
use std::process;
22+
use std::process::Command;
2223
use std::str;
2324
use std::sync::Arc;
2425

@@ -186,12 +187,16 @@ fn bench_commit(
186187
}
187188
}
188189

190+
let has_measureme = Command::new("summarize").output().is_ok();
191+
debug!("attempting self profile data: {}", has_measureme);
192+
189193
for benchmark in benchmarks {
190194
if results.contains_key(&benchmark.name) {
191195
continue;
192196
}
193197

194-
let mut processor = execute::MeasureProcessor::new();
198+
// Only collect self-profile if we have summarize in the path
199+
let mut processor = execute::MeasureProcessor::new(has_measureme);
195200
let result =
196201
benchmark.measure(&mut processor, build_kinds, run_kinds, compiler, iterations);
197202
let result = match result {

0 commit comments

Comments
 (0)