Skip to content

Commit 64c192d

Browse files
authored
Use term 'profile' instead of 'build' as that's what we're using elsewhere (#1055)
* Use term 'profile' instead of 'build' as that's what we're using elsewhere * Force rebuild
1 parent f536bf8 commit 64c192d

File tree

4 files changed

+54
-54
lines changed

4 files changed

+54
-54
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
"--exclude webrender-wrench,style-servo,cargo,rustc",
6464
"--include webrender-wrench,style-servo,cargo --exclude rustc",
6565
]
66-
BUILD_KINDS: [
66+
PROFILE_KINDS: [
6767
"Check,Doc,Debug",
6868
"Opt",
6969
]
@@ -98,7 +98,7 @@ jobs:
9898
env:
9999
JEMALLOC_OVERRIDE: /usr/lib/x86_64-linux-gnu/libjemalloc.so
100100
BENCH_INCLUDE_EXCLUDE_OPTS: ${{ matrix.BENCH_INCLUDE_EXCLUDE_OPTS }}
101-
BUILD_KINDS: ${{ matrix.BUILD_KINDS }}
101+
PROFILE_KINDS: ${{ matrix.PROFILE_KINDS }}
102102
SHELL: "/bin/bash"
103103

104104
test_profiling:

ci/check-benchmarks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUST_BACKTRACE=1 \
1717
RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
1818
cargo run -p collector --bin collector -- \
1919
bench_local $bindir/rustc Test \
20-
--builds $BUILD_KINDS \
20+
--builds $PROFILE_KINDS \
2121
--cargo $bindir/cargo \
2222
--runs All \
2323
--rustdoc $bindir/rustdoc \

collector/src/execute.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Execute benchmarks.
22
3-
use crate::{BuildKind, Compiler, ScenarioKind};
3+
use crate::{Compiler, ProfileKind, ScenarioKind};
44
use anyhow::{anyhow, bail, Context};
55
use collector::command_output;
66
use collector::etw_parser;
@@ -230,7 +230,7 @@ impl Profiler {
230230

231231
// What cargo subcommand do we need to run for this profiler? If not
232232
// `rustc`, must be a subcommand that itself invokes `rustc`.
233-
fn subcommand(&self, build_kind: BuildKind) -> Option<&'static str> {
233+
fn subcommand(&self, build_kind: ProfileKind) -> Option<&'static str> {
234234
match self {
235235
Profiler::PerfStat
236236
| Profiler::PerfStatSelfProfile
@@ -247,15 +247,15 @@ impl Profiler {
247247
| Profiler::DepGraph
248248
| Profiler::MonoItems
249249
| Profiler::Eprintln => {
250-
if build_kind == BuildKind::Doc {
250+
if build_kind == ProfileKind::Doc {
251251
Some("rustdoc")
252252
} else {
253253
Some("rustc")
254254
}
255255
}
256256
Profiler::LlvmLines => match build_kind {
257-
BuildKind::Debug | BuildKind::Opt => Some("llvm-lines"),
258-
BuildKind::Check | BuildKind::Doc => None,
257+
ProfileKind::Debug | ProfileKind::Opt => Some("llvm-lines"),
258+
ProfileKind::Check | ProfileKind::Doc => None,
259259
},
260260
}
261261
}
@@ -286,7 +286,7 @@ impl Profiler {
286286
struct CargoProcess<'a> {
287287
compiler: Compiler<'a>,
288288
cwd: &'a Path,
289-
build_kind: BuildKind,
289+
build_kind: ProfileKind,
290290
incremental: bool,
291291
processor_etc: Option<(
292292
&'a mut dyn Processor,
@@ -393,20 +393,20 @@ impl<'a> CargoProcess<'a> {
393393
}
394394
} else {
395395
match self.build_kind {
396-
BuildKind::Doc => "rustdoc",
396+
ProfileKind::Doc => "rustdoc",
397397
_ => "rustc",
398398
}
399399
};
400400

401401
let mut cmd = self.base_command(self.cwd, subcommand);
402402
cmd.arg("-p").arg(self.get_pkgid(self.cwd)?);
403403
match self.build_kind {
404-
BuildKind::Check => {
404+
ProfileKind::Check => {
405405
cmd.arg("--profile").arg("check");
406406
}
407-
BuildKind::Debug => {}
408-
BuildKind::Doc => {}
409-
BuildKind::Opt => {
407+
ProfileKind::Debug => {}
408+
ProfileKind::Doc => {}
409+
ProfileKind::Opt => {
410410
cmd.arg("--release");
411411
}
412412
}
@@ -534,7 +534,7 @@ pub enum Retry {
534534
pub struct ProcessOutputData<'a> {
535535
name: BenchmarkName,
536536
cwd: &'a Path,
537-
build_kind: BuildKind,
537+
build_kind: ProfileKind,
538538
scenario_kind: ScenarioKind,
539539
scenario_kind_str: &'a str,
540540
patch: Option<&'a Patch>,
@@ -544,7 +544,7 @@ pub struct ProcessOutputData<'a> {
544544
/// processing.
545545
pub trait Processor {
546546
/// The `Profiler` being used.
547-
fn profiler(&self, _: BuildKind) -> Profiler;
547+
fn profiler(&self, _: ProfileKind) -> Profiler;
548548

549549
/// Process the output produced by the particular `Profiler` being used.
550550
fn process_output(
@@ -563,7 +563,7 @@ pub trait Processor {
563563
///
564564
/// Return "true" if planning on doing something different for second
565565
/// iteration.
566-
fn finished_first_collection(&mut self, _: BuildKind) -> bool {
566+
fn finished_first_collection(&mut self, _: ProfileKind) -> bool {
567567
false
568568
}
569569

@@ -626,7 +626,7 @@ impl<'a> MeasureProcessor<'a> {
626626
fn insert_stats(
627627
&mut self,
628628
scenario: database::Scenario,
629-
build_kind: BuildKind,
629+
build_kind: ProfileKind,
630630
stats: (Stats, Option<SelfProfile>, Option<SelfProfileFiles>),
631631
) {
632632
let version = String::from_utf8(
@@ -643,10 +643,10 @@ impl<'a> MeasureProcessor<'a> {
643643

644644
let collection = self.rt.block_on(self.conn.collection_id(&version));
645645
let profile = match build_kind {
646-
BuildKind::Check => database::Profile::Check,
647-
BuildKind::Debug => database::Profile::Debug,
648-
BuildKind::Doc => database::Profile::Doc,
649-
BuildKind::Opt => database::Profile::Opt,
646+
ProfileKind::Check => database::Profile::Check,
647+
ProfileKind::Debug => database::Profile::Debug,
648+
ProfileKind::Doc => database::Profile::Doc,
649+
ProfileKind::Opt => database::Profile::Opt,
650650
};
651651

652652
if let Some(files) = stats.2 {
@@ -806,7 +806,7 @@ impl Upload {
806806
}
807807

808808
impl<'a> Processor for MeasureProcessor<'a> {
809-
fn profiler(&self, _build: BuildKind) -> Profiler {
809+
fn profiler(&self, _build: ProfileKind) -> Profiler {
810810
if self.is_first_collection && self.is_self_profile {
811811
if cfg!(unix) {
812812
Profiler::PerfStatSelfProfile
@@ -826,7 +826,7 @@ impl<'a> Processor for MeasureProcessor<'a> {
826826
self.is_first_collection = true;
827827
}
828828

829-
fn finished_first_collection(&mut self, build: BuildKind) -> bool {
829+
fn finished_first_collection(&mut self, build: ProfileKind) -> bool {
830830
let original = self.profiler(build);
831831
self.is_first_collection = false;
832832
// We need to run again if we're going to use a different profiler
@@ -919,7 +919,7 @@ impl<'a> ProfileProcessor<'a> {
919919
}
920920

921921
impl<'a> Processor for ProfileProcessor<'a> {
922-
fn profiler(&self, _: BuildKind) -> Profiler {
922+
fn profiler(&self, _: ProfileKind) -> Profiler {
923923
self.profiler
924924
}
925925

@@ -1292,7 +1292,7 @@ impl Benchmark {
12921292
&'a self,
12931293
compiler: Compiler<'a>,
12941294
cwd: &'a Path,
1295-
build_kind: BuildKind,
1295+
build_kind: ProfileKind,
12961296
) -> CargoProcess<'a> {
12971297
let mut cargo_args = self
12981298
.config
@@ -1339,7 +1339,7 @@ impl Benchmark {
13391339
pub fn measure(
13401340
&self,
13411341
processor: &mut dyn Processor,
1342-
build_kinds: &[BuildKind],
1342+
build_kinds: &[ProfileKind],
13431343
scenario_kinds: &[ScenarioKind],
13441344
compiler: Compiler<'_>,
13451345
iterations: Option<usize>,
@@ -1429,7 +1429,7 @@ impl Benchmark {
14291429
}
14301430

14311431
// Rustdoc does not support incremental compilation
1432-
if build_kind != BuildKind::Doc {
1432+
if build_kind != ProfileKind::Doc {
14331433
// An incremental build from scratch (slowest incremental case).
14341434
// This is required for any subsequent incremental builds.
14351435
if scenario_kinds.contains(&ScenarioKind::IncrFull)

collector/src/main.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,26 @@ impl<'a> Compiler<'a> {
4343
}
4444

4545
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
46-
pub enum BuildKind {
46+
pub enum ProfileKind {
4747
Check,
4848
Debug,
4949
Doc,
5050
Opt,
5151
}
5252

53-
impl BuildKind {
53+
impl ProfileKind {
5454
fn all() -> Vec<Self> {
5555
vec![
56-
BuildKind::Check,
57-
BuildKind::Debug,
58-
BuildKind::Doc,
59-
BuildKind::Opt,
56+
ProfileKind::Check,
57+
ProfileKind::Debug,
58+
ProfileKind::Doc,
59+
ProfileKind::Opt,
6060
]
6161
}
6262

6363
fn default() -> Vec<Self> {
6464
// Don't run rustdoc by default.
65-
vec![BuildKind::Check, BuildKind::Debug, BuildKind::Opt]
65+
vec![ProfileKind::Check, ProfileKind::Debug, ProfileKind::Opt]
6666
}
6767
}
6868

@@ -102,12 +102,12 @@ impl ScenarioKind {
102102
}
103103
}
104104

105-
// How the --builds arg maps to BuildKinds.
106-
const STRINGS_AND_BUILD_KINDS: &[(&str, BuildKind)] = &[
107-
("Check", BuildKind::Check),
108-
("Debug", BuildKind::Debug),
109-
("Doc", BuildKind::Doc),
110-
("Opt", BuildKind::Opt),
105+
// How the --builds arg maps to ProfileKinds.
106+
const STRINGS_AND_PROFILE_KINDS: &[(&str, ProfileKind)] = &[
107+
("Check", ProfileKind::Check),
108+
("Debug", ProfileKind::Debug),
109+
("Doc", ProfileKind::Doc),
110+
("Opt", ProfileKind::Opt),
111111
];
112112

113113
// How the --runs arg maps to ScenarioKinds.
@@ -118,11 +118,11 @@ const STRINGS_AND_SCENARIO_KINDS: &[(&str, ScenarioKind)] = &[
118118
("IncrPatched", ScenarioKind::IncrPatched),
119119
];
120120

121-
fn build_kinds_from_arg(arg: &Option<&str>) -> anyhow::Result<Vec<BuildKind>> {
121+
fn build_kinds_from_arg(arg: &Option<&str>) -> anyhow::Result<Vec<ProfileKind>> {
122122
if let Some(arg) = arg {
123-
kinds_from_arg("build", STRINGS_AND_BUILD_KINDS, arg)
123+
kinds_from_arg("build", STRINGS_AND_PROFILE_KINDS, arg)
124124
} else {
125-
Ok(BuildKind::default())
125+
Ok(ProfileKind::default())
126126
}
127127
}
128128

@@ -211,7 +211,7 @@ fn bench(
211211
rt: &mut Runtime,
212212
pool: database::Pool,
213213
artifact_id: &ArtifactId,
214-
build_kinds: &[BuildKind],
214+
build_kinds: &[ProfileKind],
215215
scenario_kinds: &[ScenarioKind],
216216
compiler: Compiler<'_>,
217217
benchmarks: &[Benchmark],
@@ -398,7 +398,7 @@ fn get_benchmarks(
398398
/// - `cargo`: if one is given, check if it is acceptable. Otherwise, look
399399
/// for the nightly Cargo via `rustup`.
400400
fn get_local_toolchain(
401-
build_kinds: &[BuildKind],
401+
build_kinds: &[ProfileKind],
402402
rustc: &str,
403403
rustdoc: Option<&str>,
404404
cargo: Option<&str>,
@@ -456,7 +456,7 @@ fn get_local_toolchain(
456456
Some(PathBuf::from(rustdoc).canonicalize().with_context(|| {
457457
format!("failed to canonicalize rustdoc executable '{}'", rustdoc)
458458
})?)
459-
} else if build_kinds.contains(&BuildKind::Doc) {
459+
} else if build_kinds.contains(&ProfileKind::Doc) {
460460
// We need a `rustdoc`. Look for one next to `rustc`.
461461
if let Ok(rustdoc) = rustc.with_file_name("rustdoc").canonicalize() {
462462
debug!("found rustdoc: {:?}", &rustdoc);
@@ -500,7 +500,7 @@ fn generate_cachegrind_diffs(
500500
id2: &str,
501501
out_dir: &Path,
502502
benchmarks: &[Benchmark],
503-
build_kinds: &[BuildKind],
503+
build_kinds: &[ProfileKind],
504504
scenario_kinds: &[ScenarioKind],
505505
errors: &mut BenchmarkErrors,
506506
) {
@@ -510,7 +510,7 @@ fn generate_cachegrind_diffs(
510510
if let ScenarioKind::IncrPatched = scenario_kind {
511511
continue;
512512
}
513-
if build_kind == BuildKind::Doc && scenario_kind.is_incr() {
513+
if build_kind == ProfileKind::Doc && scenario_kind.is_incr() {
514514
continue;
515515
}
516516
let filename = |prefix, id| {
@@ -614,7 +614,7 @@ fn profile(
614614
profiler: Profiler,
615615
out_dir: &Path,
616616
benchmarks: &[Benchmark],
617-
build_kinds: &[BuildKind],
617+
build_kinds: &[ProfileKind],
618618
scenario_kinds: &[ScenarioKind],
619619
errors: &mut BenchmarkErrors,
620620
) {
@@ -875,7 +875,7 @@ fn main_result() -> anyhow::Result<i32> {
875875
&mut rt,
876876
pool,
877877
&ArtifactId::Commit(commit),
878-
&BuildKind::all(),
878+
&ProfileKind::all(),
879879
&ScenarioKind::all(),
880880
Compiler::from_sysroot(&sysroot),
881881
&benchmarks,
@@ -912,10 +912,10 @@ fn main_result() -> anyhow::Result<i32> {
912912
ScenarioKind::all_non_incr()
913913
};
914914
let build_kinds = if collector::version_supports_doc(toolchain) {
915-
BuildKind::all()
915+
ProfileKind::all()
916916
} else {
917-
let mut all = BuildKind::all();
918-
let doc = all.iter().position(|bk| *bk == BuildKind::Doc).unwrap();
917+
let mut all = ProfileKind::all();
918+
let doc = all.iter().position(|bk| *bk == ProfileKind::Doc).unwrap();
919919
all.remove(doc);
920920
all
921921
};

0 commit comments

Comments
 (0)