From ea1a693d4eafc26de643b1a2f1b00f46a410a66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ko=C5=82aczkowski?= Date: Fri, 9 Aug 2024 21:16:41 +0200 Subject: [PATCH] Report latency distributions for each function separately --- src/report.rs | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/report.rs b/src/report.rs index 3c64c5b..74c5668 100644 --- a/src/report.rs +++ b/src/report.rs @@ -719,21 +719,30 @@ impl<'a> Display for BenchmarkCmp<'a> { Percentile::Max, ]; - writeln!(f)?; - writeln!(f, "{}", fmt_section_header("CYCLE LATENCY [ms]"))?; - if self.v2.is_some() { - writeln!(f, "{}", fmt_cmp_header(true))?; - } + for fn_name in self.v1.cycle_latency_by_fn.keys() { + writeln!(f)?; + writeln!( + f, + "{}", + fmt_section_header(format!("CYCLE LATENCY for {fn_name} [ms] ").as_str()) + )?; + if self.v2.is_some() { + writeln!(f, "{}", fmt_cmp_header(true))?; + } - for p in resp_time_percentiles.iter() { - let l = self - .line(p.name(), "", |s| { - let rt = s.request_latency.as_ref().map(|rt| rt.percentiles.get(*p)); - Quantity::from(rt).with_precision(3) - }) - .with_orientation(-1) - .with_significance(self.cmp_resp_time_percentile(*p)); - writeln!(f, "{l}")?; + for p in resp_time_percentiles.iter() { + let l = self + .line(p.name(), "", |s| { + let rt = s + .cycle_latency_by_fn + .get(fn_name) + .map(|l| l.percentiles.get(*p)); + Quantity::from(rt).with_precision(3) + }) + .with_orientation(-1) + .with_significance(self.cmp_resp_time_percentile(*p)); + writeln!(f, "{l}")?; + } } if self.v1.error_count > 0 {