diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs index 1e648c4581733..c2bfa62cf9d06 100644 --- a/src/librustc/util/profiling.rs +++ b/src/librustc/util/profiling.rs @@ -62,11 +62,15 @@ macro_rules! define_categories { } fn print(&self, lock: &mut StderrLock<'_>) { - writeln!(lock, "| Phase | Time (ms) | Queries | Hits (%) |") + writeln!(lock, "| Phase | Time (ms) \ + | Time (%) | Queries | Hits (%)") .unwrap(); - writeln!(lock, "| ---------------- | -------------- | -------------- | -------- |") + writeln!(lock, "| ---------------- | -------------- \ + | -------- | -------------- | --------") .unwrap(); + let total_time = ($(self.times.$name + )* 0) as f32; + $( let (hits, total) = self.query_counts.$name; let (hits, total) = if total > 0 { @@ -78,11 +82,12 @@ macro_rules! define_categories { writeln!( lock, - "| {0: <16} | {1: <14} | {2: <14} | {3: <8} |", + "| {0: <16} | {1: <14} | {2: <8.2} | {3: <14} | {4: <8}", stringify!($name), self.times.$name / 1_000_000, + ((self.times.$name as f32) / total_time) * 100.0, total, - hits + hits, ).unwrap(); )* }