Skip to content

Commit 3e23793

Browse files
committed
Rename variables and fields relating to self-profiling.
I find these names clearer, esp. for the fields in `MeasureProcessor`.
1 parent e76fee6 commit 3e23793

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,12 @@ pub struct MeasureProcessor {
310310
base_incr_stats: (Stats, Option<SelfProfile>),
311311
clean_incr_stats: (Stats, Option<SelfProfile>),
312312
patched_incr_stats: Vec<(Patch, (Stats, Option<SelfProfile>))>,
313-
314-
collecting_self_profile: bool,
315-
316-
should_collect_self_profile: bool,
313+
is_first_collection: bool,
314+
self_profile: bool,
317315
}
318316

319317
impl MeasureProcessor {
320-
pub fn new(collect_self_profile: bool) -> Self {
318+
pub fn new(self_profile: bool) -> Self {
321319
// Check we have `perf` available.
322320
let has_perf = Command::new("perf").output().is_ok();
323321
assert!(has_perf);
@@ -327,28 +325,28 @@ impl MeasureProcessor {
327325
base_incr_stats: (Stats::new(), None),
328326
clean_incr_stats: (Stats::new(), None),
329327
patched_incr_stats: Vec::new(),
330-
collecting_self_profile: true,
328+
is_first_collection: true,
331329
// Command::new("summarize").status().is_ok()
332-
should_collect_self_profile: collect_self_profile,
330+
self_profile,
333331
}
334332
}
335333
}
336334

337335
impl Processor for MeasureProcessor {
338336
fn profiler(&self) -> Profiler {
339-
if self.collecting_self_profile && self.should_collect_self_profile {
337+
if self.is_first_collection && self.self_profile {
340338
Profiler::PerfStatSelfProfile
341339
} else {
342340
Profiler::PerfStat
343341
}
344342
}
345343

346344
fn start_first_collection(&mut self) {
347-
self.collecting_self_profile = true;
345+
self.is_first_collection = true;
348346
}
349347

350348
fn finished_first_collection(&mut self) -> bool {
351-
self.collecting_self_profile = false;
349+
self.is_first_collection = false;
352350
true
353351
}
354352

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ where
150150
fn process_commits(
151151
out_repo: outrepo::Repo,
152152
benchmarks: &[Benchmark],
153-
collect_self_profile: bool,
153+
self_profile: bool,
154154
) -> anyhow::Result<()> {
155155
println!("processing commits");
156156
let client = reqwest::Client::new();
@@ -180,7 +180,7 @@ fn process_commits(
180180
&benchmarks,
181181
3,
182182
true,
183-
collect_self_profile,
183+
self_profile,
184184
));
185185
if let Err(err) = result {
186186
panic!("failed to record success: {:?}", err);
@@ -254,7 +254,7 @@ fn bench_commit(
254254
benchmarks: &[Benchmark],
255255
iterations: usize,
256256
call_home: bool,
257-
collect_self_profile: bool,
257+
self_profile: bool,
258258
) -> CommitData {
259259
info!(
260260
"benchmarking commit {} ({}) for triple {}",
@@ -285,7 +285,7 @@ fn bench_commit(
285285
}
286286

287287
let has_measureme = Command::new("summarize").output().is_ok();
288-
if collect_self_profile {
288+
if self_profile {
289289
assert!(
290290
has_measureme,
291291
"needs `summarize` in PATH for self profile.\n\
@@ -298,7 +298,7 @@ fn bench_commit(
298298
continue;
299299
}
300300

301-
let mut processor = execute::MeasureProcessor::new(collect_self_profile);
301+
let mut processor = execute::MeasureProcessor::new(self_profile);
302302
let result =
303303
benchmark.measure(&mut processor, build_kinds, run_kinds, compiler, iterations);
304304
let result = match result {
@@ -455,7 +455,7 @@ fn main_result() -> anyhow::Result<i32> {
455455
let exclude = matches.value_of("exclude");
456456
let benchmarks = get_benchmarks(&benchmark_dir, filter, exclude)?;
457457
let use_remote = matches.is_present("sync_git");
458-
let collect_self_profile = matches.is_present("self_profile");
458+
let self_profile = matches.is_present("self_profile");
459459

460460
let get_out_dir = || {
461461
let path = PathBuf::from(matches.value_of_os("output_repo").unwrap());
@@ -483,7 +483,7 @@ fn main_result() -> anyhow::Result<i32> {
483483
&benchmarks,
484484
3,
485485
false,
486-
collect_self_profile,
486+
self_profile,
487487
))?;
488488
Ok(0)
489489
}
@@ -523,7 +523,7 @@ fn main_result() -> anyhow::Result<i32> {
523523
&benchmarks,
524524
1,
525525
false,
526-
collect_self_profile,
526+
self_profile,
527527
);
528528
get_out_repo(true)?.add_commit_data(&result)?;
529529
Ok(0)
@@ -536,7 +536,7 @@ fn main_result() -> anyhow::Result<i32> {
536536
}
537537

538538
("process", Some(_)) => {
539-
process_commits(get_out_repo(false)?, &benchmarks, collect_self_profile)?;
539+
process_commits(get_out_repo(false)?, &benchmarks, self_profile)?;
540540
Ok(0)
541541
}
542542

@@ -621,7 +621,7 @@ fn main_result() -> anyhow::Result<i32> {
621621
&benchmarks,
622622
1,
623623
false,
624-
collect_self_profile,
624+
self_profile,
625625
);
626626
} else {
627627
panic!("no commits");

0 commit comments

Comments
 (0)