Skip to content

Commit c17ff4b

Browse files
authored
Merge pull request #942 from rylev/consistent-terminology
Consistent terminology
2 parents ed3b35e + 4f7bc41 commit c17ff4b

File tree

16 files changed

+623
-522
lines changed

16 files changed

+623
-522
lines changed

collector/src/execute.rs

Lines changed: 97 additions & 73 deletions
Large diffs are not rendered by default.

collector/src/execute/rustc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ fn record(
4343
.arg("--hard")
4444
.arg(match artifact {
4545
ArtifactId::Commit(c) => c.sha.as_str(),
46-
ArtifactId::Artifact(id) => id.as_str(),
46+
ArtifactId::Tag(id) => id.as_str(),
4747
})
4848
.status()
4949
.context("git reset --hard")?;
5050

51-
if !status.success() && matches!(artifact, ArtifactId::Artifact(_)) {
51+
if !status.success() && matches!(artifact, ArtifactId::Tag(_)) {
5252
log::warn!(
5353
"git reset --hard {} failed - trying default branch",
5454
artifact
@@ -165,12 +165,12 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
165165
.arg("origin")
166166
.arg(match artifact {
167167
ArtifactId::Commit(c) => c.sha.as_str(),
168-
ArtifactId::Artifact(id) => id.as_str(),
168+
ArtifactId::Tag(id) => id.as_str(),
169169
})
170170
.status()
171171
.context("git fetch origin")?;
172172

173-
if !status.success() && matches!(artifact, ArtifactId::Artifact(_)) {
173+
if !status.success() && matches!(artifact, ArtifactId::Tag(_)) {
174174
log::warn!(
175175
"git fetch origin {} failed - trying default branch",
176176
artifact

collector/src/main.rs

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -67,28 +67,28 @@ impl BuildKind {
6767
}
6868

6969
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
70-
pub enum RunKind {
70+
pub enum ScenarioKind {
7171
Full,
7272
IncrFull,
7373
IncrUnchanged,
7474
IncrPatched,
7575
}
7676

77-
impl RunKind {
78-
fn all() -> Vec<RunKind> {
77+
impl ScenarioKind {
78+
fn all() -> Vec<ScenarioKind> {
7979
vec![
80-
RunKind::Full,
81-
RunKind::IncrFull,
82-
RunKind::IncrUnchanged,
83-
RunKind::IncrPatched,
80+
ScenarioKind::Full,
81+
ScenarioKind::IncrFull,
82+
ScenarioKind::IncrUnchanged,
83+
ScenarioKind::IncrPatched,
8484
]
8585
}
8686

87-
fn all_non_incr() -> Vec<RunKind> {
88-
vec![RunKind::Full]
87+
fn all_non_incr() -> Vec<ScenarioKind> {
88+
vec![ScenarioKind::Full]
8989
}
9090

91-
fn default() -> Vec<RunKind> {
91+
fn default() -> Vec<ScenarioKind> {
9292
Self::all()
9393
}
9494
}
@@ -101,12 +101,12 @@ const STRINGS_AND_BUILD_KINDS: &[(&str, BuildKind)] = &[
101101
("Opt", BuildKind::Opt),
102102
];
103103

104-
// How the --runs arg maps to RunKinds.
105-
const STRINGS_AND_RUN_KINDS: &[(&str, RunKind)] = &[
106-
("Full", RunKind::Full),
107-
("IncrFull", RunKind::IncrFull),
108-
("IncrUnchanged", RunKind::IncrUnchanged),
109-
("IncrPatched", RunKind::IncrPatched),
104+
// How the --runs arg maps to ScenarioKinds.
105+
const STRINGS_AND_SCENARIO_KINDS: &[(&str, ScenarioKind)] = &[
106+
("Full", ScenarioKind::Full),
107+
("IncrFull", ScenarioKind::IncrFull),
108+
("IncrUnchanged", ScenarioKind::IncrUnchanged),
109+
("IncrPatched", ScenarioKind::IncrPatched),
110110
];
111111

112112
fn build_kinds_from_arg(arg: &Option<&str>) -> anyhow::Result<Vec<BuildKind>> {
@@ -117,11 +117,11 @@ fn build_kinds_from_arg(arg: &Option<&str>) -> anyhow::Result<Vec<BuildKind>> {
117117
}
118118
}
119119

120-
fn run_kinds_from_arg(arg: Option<&str>) -> anyhow::Result<Vec<RunKind>> {
120+
fn scenario_kinds_from_arg(arg: Option<&str>) -> anyhow::Result<Vec<ScenarioKind>> {
121121
if let Some(arg) = arg {
122-
kinds_from_arg("run", STRINGS_AND_RUN_KINDS, arg)
122+
kinds_from_arg("run", STRINGS_AND_SCENARIO_KINDS, arg)
123123
} else {
124-
Ok(RunKind::default())
124+
Ok(ScenarioKind::default())
125125
}
126126
}
127127

@@ -203,7 +203,7 @@ fn bench(
203203
pool: database::Pool,
204204
artifact_id: &ArtifactId,
205205
build_kinds: &[BuildKind],
206-
run_kinds: &[RunKind],
206+
scenario_kinds: &[ScenarioKind],
207207
compiler: Compiler<'_>,
208208
benchmarks: &[Benchmark],
209209
iterations: Option<usize>,
@@ -269,8 +269,13 @@ fn bench(
269269
artifact_row_id,
270270
is_self_profile,
271271
);
272-
let result =
273-
benchmark.measure(&mut processor, build_kinds, run_kinds, compiler, iterations);
272+
let result = benchmark.measure(
273+
&mut processor,
274+
build_kinds,
275+
scenario_kinds,
276+
compiler,
277+
iterations,
278+
);
274279
if let Err(s) = result {
275280
eprintln!(
276281
"collector error: Failed to benchmark '{}', recorded: {:#}",
@@ -592,7 +597,7 @@ fn main_result() -> anyhow::Result<i32> {
592597
let db = sub_m.value_of("DB").unwrap_or(default_db);
593598
let exclude = sub_m.value_of("EXCLUDE");
594599
let include = sub_m.value_of("INCLUDE");
595-
let run_kinds = run_kinds_from_arg(sub_m.value_of("RUNS"))?;
600+
let scenario_kinds = scenario_kinds_from_arg(sub_m.value_of("RUNS"))?;
596601
let iterations = iterations_from_arg(sub_m.value_of("ITERATIONS"))?;
597602
let rustdoc = sub_m.value_of("RUSTDOC");
598603
let is_self_profile = sub_m.is_present("SELF_PROFILE");
@@ -606,9 +611,9 @@ fn main_result() -> anyhow::Result<i32> {
606611
let res = bench(
607612
&mut rt,
608613
pool,
609-
&ArtifactId::Artifact(id.to_string()),
614+
&ArtifactId::Tag(id.to_string()),
610615
&build_kinds,
611-
&run_kinds,
616+
&scenario_kinds,
612617
Compiler {
613618
rustc: &rustc,
614619
rustdoc: rustdoc.as_deref(),
@@ -663,7 +668,7 @@ fn main_result() -> anyhow::Result<i32> {
663668
pool,
664669
&ArtifactId::Commit(commit),
665670
&BuildKind::all(),
666-
&RunKind::all(),
671+
&ScenarioKind::all(),
667672
Compiler::from_sysroot(&sysroot),
668673
&benchmarks,
669674
next.runs.map(|v| v as usize),
@@ -693,10 +698,10 @@ fn main_result() -> anyhow::Result<i32> {
693698

694699
let pool = database::Pool::open(db);
695700

696-
let run_kinds = if collector::version_supports_incremental(toolchain) {
697-
RunKind::all()
701+
let scenario_kinds = if collector::version_supports_incremental(toolchain) {
702+
ScenarioKind::all()
698703
} else {
699-
RunKind::all_non_incr()
704+
ScenarioKind::all_non_incr()
700705
};
701706
let build_kinds = if collector::version_supports_doc(toolchain) {
702707
BuildKind::all()
@@ -731,9 +736,9 @@ fn main_result() -> anyhow::Result<i32> {
731736
let res = bench(
732737
&mut rt,
733738
pool,
734-
&ArtifactId::Artifact(toolchain.to_string()),
739+
&ArtifactId::Tag(toolchain.to_string()),
735740
&build_kinds,
736-
&run_kinds,
741+
&scenario_kinds,
737742
Compiler {
738743
rustc: Path::new(rustc.trim()),
739744
rustdoc: Some(Path::new(rustdoc.trim())),
@@ -761,7 +766,7 @@ fn main_result() -> anyhow::Result<i32> {
761766
let exclude = sub_m.value_of("EXCLUDE");
762767
let include = sub_m.value_of("INCLUDE");
763768
let out_dir = PathBuf::from(sub_m.value_of_os("OUT_DIR").unwrap_or(default_out_dir));
764-
let run_kinds = run_kinds_from_arg(sub_m.value_of("RUNS"))?;
769+
let scenario_kinds = scenario_kinds_from_arg(sub_m.value_of("RUNS"))?;
765770
let rustdoc = sub_m.value_of("RUSTDOC");
766771

767772
let (rustc, rustdoc, cargo) = get_local_toolchain(&build_kinds, rustc, rustdoc, cargo)?;
@@ -782,8 +787,13 @@ fn main_result() -> anyhow::Result<i32> {
782787
for (i, benchmark) in benchmarks.iter().enumerate() {
783788
eprintln!("{}", n_benchmarks_remaining(benchmarks.len() - i));
784789
let mut processor = execute::ProfileProcessor::new(profiler, &out_dir, &id);
785-
let result =
786-
benchmark.measure(&mut processor, &build_kinds, &run_kinds, compiler, Some(1));
790+
let result = benchmark.measure(
791+
&mut processor,
792+
&build_kinds,
793+
&scenario_kinds,
794+
compiler,
795+
Some(1),
796+
);
787797
if let Err(ref s) = result {
788798
errors.incr();
789799
eprintln!(

database/src/bin/import-sqlite.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,39 @@ async fn main() {
3838
let sqlite_aid = sqlite_conn.artifact_id(&aid).await;
3939
let postgres_aid = postgres_conn.artifact_id(&aid).await;
4040

41-
for &(krate, profile, cache, stat) in sqlite_idx.all_pstat_series() {
42-
if benchmarks.insert(krate) {
43-
postgres_conn.record_benchmark(krate.as_str(), None).await;
41+
for &(benchmark, profile, scenario, metric) in sqlite_idx.all_statistic_descriptions() {
42+
if benchmarks.insert(benchmark) {
43+
postgres_conn
44+
.record_benchmark(benchmark.as_str(), None)
45+
.await;
4446
}
4547

46-
let id = database::DbLabel::ProcessStat {
47-
krate,
48+
let id = database::DbLabel::StatisticDescription {
49+
benchmark,
4850
profile,
49-
cache,
50-
stat,
51+
scenario,
52+
metric,
5153
}
5254
.lookup(&sqlite_idx)
5355
.unwrap();
5456

55-
let value = sqlite_conn
57+
let stat = sqlite_conn
5658
.get_pstats(&[id], &[Some(sqlite_aid)])
5759
.await
5860
.pop()
5961
.unwrap()
6062
.pop()
6163
.unwrap();
62-
if let Some(value) = value {
64+
if let Some(stat) = stat {
6365
postgres_conn
6466
.record_statistic(
6567
cid,
6668
postgres_aid,
67-
&krate.to_string(),
69+
&benchmark.to_string(),
6870
profile,
69-
cache,
70-
stat.as_str(),
71-
value,
71+
scenario,
72+
metric.as_str(),
73+
stat,
7274
)
7375
.await;
7476
}

0 commit comments

Comments
 (0)