Track discard time of excess packets in sigverify (#22554) (#22569)

* discard time histogram

* closer to the if

* update

(cherry picked from commit e616a7ebfc)

# Conflicts:
#	core/src/sigverify_stage.rs

Co-authored-by: anatoly yakovenko <anatoly@solana.com>
This commit is contained in:
mergify[bot]
2022-01-19 02:42:13 +00:00
committed by GitHub
parent 4706aa4900
commit 42c3fbc198

View File

@ -49,6 +49,7 @@ pub struct DisabledSigVerifier {}
struct SigVerifierStats { struct SigVerifierStats {
recv_batches_us_hist: histogram::Histogram, // time to call recv_batch recv_batches_us_hist: histogram::Histogram, // time to call recv_batch
verify_batches_pp_us_hist: histogram::Histogram, // per-packet 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
batches_hist: histogram::Histogram, // number of packet batches per verify call batches_hist: histogram::Histogram, // number of packet batches per verify call
packets_hist: histogram::Histogram, // number of packets per verify call packets_hist: histogram::Histogram, // number of packets per verify call
total_batches: usize, total_batches: usize,
@ -99,6 +100,28 @@ impl SigVerifierStats {
self.verify_batches_pp_us_hist.mean().unwrap_or(0), self.verify_batches_pp_us_hist.mean().unwrap_or(0),
i64 i64
), ),
(
"discard_packets_pp_us_90pct",
self.discard_packets_pp_us_hist
.percentile(90.0)
.unwrap_or(0),
i64
),
(
"discard_packets_pp_us_min",
self.discard_packets_pp_us_hist.minimum().unwrap_or(0),
i64
),
(
"discard_packets_pp_us_max",
self.discard_packets_pp_us_hist.maximum().unwrap_or(0),
i64
),
(
"discard_packets_pp_us_mean",
self.discard_packets_pp_us_hist.mean().unwrap_or(0),
i64
),
( (
"batches_90pct", "batches_90pct",
self.batches_hist.percentile(90.0).unwrap_or(0), self.batches_hist.percentile(90.0).unwrap_or(0),
@ -179,9 +202,11 @@ impl SigVerifyStage {
let mut verify_batch_time = Measure::start("sigverify_batch_time"); let mut verify_batch_time = Measure::start("sigverify_batch_time");
let batches_len = batches.len(); let batches_len = batches.len();
debug!("@{:?} verifier: verifying: {}", timing::timestamp(), len,); debug!("@{:?} verifier: verifying: {}", timing::timestamp(), len,);
let mut discard_time = Measure::start("sigverify_discard_time");
if len > MAX_SIGVERIFY_BATCH { if len > MAX_SIGVERIFY_BATCH {
Self::discard_excess_packets(&mut batches, MAX_SIGVERIFY_BATCH); Self::discard_excess_packets(&mut batches, MAX_SIGVERIFY_BATCH);
} }
discard_time.stop();
sendr.send(verifier.verify_batches(batches))?; sendr.send(verifier.verify_batches(batches))?;
verify_batch_time.stop(); verify_batch_time.stop();
@ -210,6 +235,10 @@ impl SigVerifyStage {
.verify_batches_pp_us_hist .verify_batches_pp_us_hist
.increment(verify_batch_time.as_us() / (len as u64)) .increment(verify_batch_time.as_us() / (len as u64))
.unwrap(); .unwrap();
stats
.discard_packets_pp_us_hist
.increment(discard_time.as_us() / (len as u64))
.unwrap();
stats.batches_hist.increment(batches_len as u64).unwrap(); stats.batches_hist.increment(batches_len as u64).unwrap();
stats.packets_hist.increment(len as u64).unwrap(); stats.packets_hist.increment(len as u64).unwrap();
stats.total_batches += batches_len; stats.total_batches += batches_len;