diff options
| author | bors <bors@rust-lang.org> | 2022-04-25 04:24:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-25 04:24:10 +0000 |
| commit | fedbe5dabc815bd710217221bfebad1ff9f37a43 (patch) | |
| tree | 5db43594a4a0fec41c5e1a605f5fc05c01d1a3c2 /src/bootstrap | |
| parent | 1f631e8e93681ddc6e62d6ba6065cac7c449534c (diff) | |
| parent | 0fea00759fea1b25a60d2b729f61c885399bda83 (diff) | |
| download | rust-fedbe5dabc815bd710217221bfebad1ff9f37a43.tar.gz rust-fedbe5dabc815bd710217221bfebad1ff9f37a43.zip | |
Auto merge of #96106 - jihiggins:issue-96060, r=Mark-Simulacrum
Add type_name info to [TIMING] log output
Adds type_name to the [TIMING] log output:
```
[TIMING] (bootstrap::compile::Sysroot) Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } -- 0.020
[TIMING] (bootstrap::builder::Builder::sysroot_libdir::Libdir) Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } -- 0.007
```
Not sure if that's the best way to format it. Thought about replacing the struct's name with the type_name output, but that feels kind of hacky?
Closes #96060
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/builder.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 0c4f3265dbf..f803388f0a6 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1,4 +1,4 @@ -use std::any::Any; +use std::any::{type_name, Any}; use std::cell::{Cell, RefCell}; use std::collections::BTreeSet; use std::env; @@ -1763,7 +1763,16 @@ impl<'a> Builder<'a> { }; if self.config.print_step_timings && !self.config.dry_run { - println!("[TIMING] {:?} -- {}.{:03}", step, dur.as_secs(), dur.subsec_millis()); + let step_string = format!("{:?}", step); + let brace_index = step_string.find("{").unwrap_or(0); + let type_string = type_name::<S>(); + println!( + "[TIMING] {} {} -- {}.{:03}", + &type_string.strip_prefix("bootstrap::").unwrap_or(type_string), + &step_string[brace_index..], + dur.as_secs(), + dur.subsec_millis() + ); } { |
