Skip to content

Commit

Permalink
Auto merge of rust-lang#96106 - jihiggins:issue-96060, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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 rust-lang#96060
  • Loading branch information
bors committed Apr 25, 2022
2 parents 1f631e8 + 0fea007 commit fedbe5d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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()
);
}

{
Expand Down

0 comments on commit fedbe5d

Please sign in to comment.