diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2018-12-10 21:16:19 -0500 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2018-12-10 22:25:52 -0500 |
| commit | 771e8b82af5921c52f2f6074196002f8a951f596 (patch) | |
| tree | 3f468782d4103b1a5d81a4d8d442373716c229b0 | |
| parent | da1527cb06c7245f83ca51903ea2a27631820215 (diff) | |
| download | rust-771e8b82af5921c52f2f6074196002f8a951f596.tar.gz rust-771e8b82af5921c52f2f6074196002f8a951f596.zip | |
[self-profiler] Add column for percent of total time
| -rw-r--r-- | src/librustc/util/profiling.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs index 1e648c45817..c2bfa62cf9d 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(); )* } |
