Skip to content

Commit fedbe5d

Browse files
committed
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
2 parents 1f631e8 + 0fea007 commit fedbe5d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/bootstrap/builder.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::any::Any;
1+
use std::any::{type_name, Any};
22
use std::cell::{Cell, RefCell};
33
use std::collections::BTreeSet;
44
use std::env;
@@ -1763,7 +1763,16 @@ impl<'a> Builder<'a> {
17631763
};
17641764

17651765
if self.config.print_step_timings && !self.config.dry_run {
1766-
println!("[TIMING] {:?} -- {}.{:03}", step, dur.as_secs(), dur.subsec_millis());
1766+
let step_string = format!("{:?}", step);
1767+
let brace_index = step_string.find("{").unwrap_or(0);
1768+
let type_string = type_name::<S>();
1769+
println!(
1770+
"[TIMING] {} {} -- {}.{:03}",
1771+
&type_string.strip_prefix("bootstrap::").unwrap_or(type_string),
1772+
&step_string[brace_index..],
1773+
dur.as_secs(),
1774+
dur.subsec_millis()
1775+
);
17671776
}
17681777

17691778
{

0 commit comments

Comments
 (0)