diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2018-06-13 20:49:22 -0400 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2018-08-02 18:57:24 -0400 |
| commit | 579facaba2a11883e24d29c6ac4770942ce3cd50 (patch) | |
| tree | 6ece29294d174eb7e6daf3e1d5942b6fdc9ad77a | |
| parent | 4552607d64669335e12cb4c69e02a759668cba22 (diff) | |
| download | rust-579facaba2a11883e24d29c6ac4770942ce3cd50.tar.gz rust-579facaba2a11883e24d29c6ac4770942ce3cd50.zip | |
Include query hits/totals
| -rw-r--r-- | src/librustc/util/profiling.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs index b32122aad85..bbb7bd083b0 100644 --- a/src/librustc/util/profiling.rs +++ b/src/librustc/util/profiling.rs @@ -123,9 +123,16 @@ impl CategoryData { fn json(&self) -> String { macro_rules! j { - ($category:tt, $rustic_name:ident) => { - format!("{{ \"category\": {}, \"time_ms\": {} }}", stringify!($category), self.times.$rustic_name / 1_000_000) - } + ($category:tt, $rustic_name:ident) => {{ + let (hits, total) = self.query_counts.$rustic_name; + + format!("{{ \"category\": {}, \"time_ms\": {}, \"query_count\": {}, \"query_hits\": {} }}", + stringify!($category), + self.times.$rustic_name / 1_000_000, + total, + format!("{:.2}", (((hits as f32) / (total as f32)) * 100.0)) + ) + }} } format!("[ |
