about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWesley Wiser <wwiser@gmail.com>2018-05-30 23:41:20 -0400
committerWesley Wiser <wwiser@gmail.com>2018-08-02 18:57:24 -0400
commit0f43800d10efd4e6255d375dad00be6b8ab6b5d7 (patch)
tree36aa20400dd88549e810c66a179966894c06eb52
parentaceee88c1add37cf02c1b67ebdd987696d4e6a43 (diff)
downloadrust-0f43800d10efd4e6255d375dad00be6b8ab6b5d7.tar.gz
rust-0f43800d10efd4e6255d375dad00be6b8ab6b5d7.zip
Switch to markdown output
-rw-r--r--src/librustc/util/profiling.rs27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs
index cf165a2afef..5bb1ddd669b 100644
--- a/src/librustc/util/profiling.rs
+++ b/src/librustc/util/profiling.rs
@@ -90,25 +90,27 @@ impl CategoryData {
     fn print(&self, lock: &mut StdoutLock) {
         macro_rules! p {
             ($name:tt, $rustic_name:ident) => {
+                let (hits, total) = self.query_counts.$rustic_name;
+                let (hits, total) = if total > 0 {
+                    (format!("{:.2}%", (((hits as f32) / (total as f32)) * 100.0)), total.to_string())
+                } else {
+                    ("".into(), "".into())
+                };
+
                 writeln!(
                    lock,
-                   "{0: <15} \t\t {1: <15}ms",
+                   "| {0: <16} | {1: <14} | {2: <14} | {3: <8} |",
                    $name,
-                   self.times.$rustic_name / 1_000_000
+                   self.times.$rustic_name / 1_000_000,
+                   total,
+                   hits
                 ).unwrap();
-                
-                let (hits, total) = self.query_counts.$rustic_name;
-                if total > 0 {
-                    writeln!(
-                        lock,
-                        "\t{} hits {} queries",
-                        hits,
-                        total
-                    ).unwrap();
-                }
             };
         }
 
+        writeln!(lock, "| Phase            | Time (ms)      | Queries        | Hits (%) |").unwrap();
+        writeln!(lock, "| ---------------- | -------------- | -------------- | -------- |").unwrap();
+
         p!("Parsing", parsing);
         p!("Expansion", expansion);
         p!("TypeChecking", type_checking);
@@ -222,6 +224,7 @@ impl SelfProfiler {
         let crate_name = opts.crate_name.as_ref().map(|n| format!(" for {}", n)).unwrap_or_default();
 
         writeln!(lock, "Self profiling results{}:", crate_name).unwrap();
+        writeln!(lock).unwrap();
 
         self.data.print(&mut lock);