Skip to content

Commit 579faca

Browse files
committed
Include query hits/totals
1 parent 4552607 commit 579faca

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/librustc/util/profiling.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,16 @@ impl CategoryData {
123123

124124
fn json(&self) -> String {
125125
macro_rules! j {
126-
($category:tt, $rustic_name:ident) => {
127-
format!("{{ \"category\": {}, \"time_ms\": {} }}", stringify!($category), self.times.$rustic_name / 1_000_000)
128-
}
126+
($category:tt, $rustic_name:ident) => {{
127+
let (hits, total) = self.query_counts.$rustic_name;
128+
129+
format!("{{ \"category\": {}, \"time_ms\": {}, \"query_count\": {}, \"query_hits\": {} }}",
130+
stringify!($category),
131+
self.times.$rustic_name / 1_000_000,
132+
total,
133+
format!("{:.2}", (((hits as f32) / (total as f32)) * 100.0))
134+
)
135+
}}
129136
}
130137

131138
format!("[

0 commit comments

Comments
 (0)