pub struct LatencyReport {
pub impl_name: &'static str,
pub warnings: &'static [&'static str],
pub p50: u64,
pub p90: u64,
pub p99: u64,
pub p999: u64,
pub max: u64,
pub loc_delta: Vec<(usize, Option<u64>)>,
}
impl LatencyReport {
pub fn print(&self, clock: &quanta::Clock) {
println!("== {} ==", self.impl_name);
for w in self.warnings {
println!(" WARN: {w}");
}
let row = |label: &str, raw: u64| {
let ns = clock.delta_as_nanos(0, raw);
println!(" {label:<6} {raw:>7} cycles ({ns:>5} ns)");
};
row("p50", self.p50);
row("p90", self.p90);
row("p99", self.p99);
row("p99.9", self.p999);
row("max", self.max);
println!();
println!(
" Local timer interrupts during run (per cpu, nohz_full should keep these near 0):"
);
for (cpu, delta) in &self.loc_delta {
match delta {
Some(d) => println!(" cpu{cpu:>2}: +{d}"),
None => println!(" cpu{cpu:>2}: unreadable"),
}
}
}
}