Skip to content

Commit 1fcd9e4

Browse files
committed
Initial implementation of rustdoc benchmarking
1 parent 75936b2 commit 1fcd9e4

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ impl Profiler {
176176
| Profiler::DHAT
177177
| Profiler::Massif
178178
| Profiler::Eprintln => true,
179-
Profiler::LlvmLines => build_kind != BuildKind::Check,
179+
Profiler::LlvmLines => match build_kind {
180+
BuildKind::Debug | BuildKind::Opt => true,
181+
BuildKind::Check | BuildKind::Doc => false,
182+
}
180183
}
181184
}
182185

@@ -242,7 +245,7 @@ impl<'a> CargoProcess<'a> {
242245
.arg(subcommand)
243246
.arg("--manifest-path")
244247
.arg(&self.manifest_path);
245-
cmd
248+
dbg!(cmd)
246249
}
247250

248251
fn get_pkgid(&self, cwd: &Path) -> String {
@@ -276,7 +279,11 @@ impl<'a> CargoProcess<'a> {
276279
));
277280
}
278281

279-
profiler.subcommand()
282+
if self.build_kind == BuildKind::Doc {
283+
dbg!("doc")
284+
} else {
285+
profiler.subcommand()
286+
}
280287
} else {
281288
"rustc"
282289
};
@@ -288,6 +295,7 @@ impl<'a> CargoProcess<'a> {
288295
cmd.arg("--profile").arg("check");
289296
}
290297
BuildKind::Debug => {}
298+
BuildKind::Doc => {}
291299
BuildKind::Opt => {
292300
cmd.arg("--release");
293301
}
@@ -438,6 +446,7 @@ impl<'a> MeasureProcessor<'a> {
438446
let profile = match build_kind {
439447
BuildKind::Check => database::Profile::Check,
440448
BuildKind::Debug => database::Profile::Debug,
449+
BuildKind::Doc => database::Profile::Doc,
441450
BuildKind::Opt => database::Profile::Opt,
442451
};
443452
let mut buf = FuturesUnordered::new();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ impl<'a> Compiler<'a> {
4949
pub enum BuildKind {
5050
Check,
5151
Debug,
52+
Doc,
5253
Opt,
5354
}
5455

database/src/bin/ingest-json.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ async fn ingest<T: Ingesting>(conn: &T, caches: &mut IdCache, path: &Path) {
934934
let profile_str = match profile {
935935
Profile::Check => "check",
936936
Profile::Debug => "debug",
937+
Profile::Doc => "doc",
937938
Profile::Opt => "opt",
938939
};
939940
let state = match &run.state {

database/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ impl Ord for Commit {
284284
pub enum Profile {
285285
Check,
286286
Debug,
287+
Doc,
287288
Opt,
288289
}
289290

@@ -293,6 +294,7 @@ impl std::str::FromStr for Profile {
293294
Ok(match s.to_ascii_lowercase().as_str() {
294295
"check" => Profile::Check,
295296
"debug" => Profile::Debug,
297+
"doc" => Profile::Doc,
296298
"opt" => Profile::Opt,
297299
_ => return Err(format!("{} is not a profile", s)),
298300
})
@@ -308,6 +310,7 @@ impl fmt::Display for Profile {
308310
Profile::Check => "check",
309311
Profile::Opt => "opt",
310312
Profile::Debug => "debug",
313+
Profile::Doc => "doc",
311314
}
312315
)
313316
}

site/src/server.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub fn handle_info(data: &InputData) -> info::Response {
6464
pub struct ByProfile<T> {
6565
pub check: T,
6666
pub debug: T,
67+
pub doc: T,
6768
pub opt: T,
6869
}
6970

@@ -76,6 +77,7 @@ impl<T> ByProfile<T> {
7677
Ok(ByProfile {
7778
check: f(Profile::Check).await?,
7879
debug: f(Profile::Debug).await?,
80+
doc: f(Profile::Doc).await?,
7981
opt: f(Profile::Opt).await?,
8082
})
8183
}
@@ -87,6 +89,7 @@ impl<T> std::ops::Index<Profile> for ByProfile<T> {
8789
match index {
8890
Profile::Check => &self.check,
8991
Profile::Debug => &self.debug,
92+
Profile::Doc => &self.doc,
9093
Profile::Opt => &self.opt,
9194
}
9295
}

0 commit comments

Comments
 (0)