Include query hits/totals
This commit is contained in:
parent
4552607d64
commit
579facaba2
1 changed files with 10 additions and 3 deletions
|
@ -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!("[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue