From 3fd5e12316eeeb7c3e1ed7ce575a8d28d784d2c3 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Fri, 1 Mar 2024 07:52:33 -0800 Subject: [PATCH] Add per-batch verify time metrics to sigverify --- core/src/sigverify_stage.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/core/src/sigverify_stage.rs b/core/src/sigverify_stage.rs index e5e06a3bc701c9..915455275fbe84 100644 --- a/core/src/sigverify_stage.rs +++ b/core/src/sigverify_stage.rs @@ -75,6 +75,7 @@ pub struct DisabledSigVerifier {} #[derive(Default)] struct SigVerifierStats { recv_batches_us_hist: histogram::Histogram, // time to call recv_batch + verify_batches_us_hist: histogram::Histogram, // per-batch time to call verify_batch verify_batches_pp_us_hist: histogram::Histogram, // per-packet time to call verify_batch discard_packets_pp_us_hist: histogram::Histogram, // per-packet time to call verify_batch dedup_packets_pp_us_hist: histogram::Histogram, // per-packet time to call verify_batch @@ -119,6 +120,26 @@ impl SigVerifierStats { self.recv_batches_us_hist.mean().unwrap_or(0), i64 ), + ( + "verify_batches_us_90pct", + self.verify_batches_us_hist.percentile(90.0).unwrap_or(0), + i64 + ), + ( + "verify_batches_us_min", + self.verify_batches_us_hist.minimum().unwrap_or(0), + i64 + ), + ( + "verify_batches_us_max", + self.verify_batches_us_hist.maximum().unwrap_or(0), + i64 + ), + ( + "verify_batches_us_mean", + self.verify_batches_us_hist.mean().unwrap_or(0), + i64 + ), ( "verify_batches_pp_us_90pct", self.verify_batches_pp_us_hist.percentile(90.0).unwrap_or(0), @@ -374,6 +395,10 @@ impl SigVerifyStage { .recv_batches_us_hist .increment(recv_duration.as_micros() as u64) .unwrap(); + stats + .verify_batches_us_hist + .increment(verify_time.as_us()) + .unwrap(); stats .verify_batches_pp_us_hist .increment(verify_time.as_us() / (num_packets as u64))