Skip to content

Commit

Permalink
Add per-batch verify time metrics to sigverify
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Mar 1, 2024
1 parent cd4cf81 commit 3fd5e12
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions core/src/sigverify_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 3fd5e12

Please sign in to comment.