diff --git a/Cargo.lock b/Cargo.lock index fc83d74372bed7..540b5632db8627 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7191,6 +7191,7 @@ dependencies = [ "rand 0.8.5", "rustls", "solana-logger", + "solana-measure", "solana-metrics", "solana-perf", "solana-sdk", diff --git a/streamer/Cargo.toml b/streamer/Cargo.toml index 22170e6426c433..55d0030e734607 100644 --- a/streamer/Cargo.toml +++ b/streamer/Cargo.toml @@ -26,6 +26,7 @@ quinn = { workspace = true } quinn-proto = { workspace = true } rand = { workspace = true } rustls = { workspace = true, features = ["dangerous_configuration"] } +solana-measure = { workspace = true } solana-metrics = { workspace = true } solana-perf = { workspace = true } solana-sdk = { workspace = true } diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index 901076da10f9d0..0a5b0ef3fe6c03 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -17,6 +17,7 @@ use { quinn::{Connecting, Connection, Endpoint, EndpointConfig, TokioRuntime, VarInt}, quinn_proto::VarIntBoundsExceeded, rand::{thread_rng, Rng}, + solana_measure::measure::Measure, solana_perf::packet::{PacketBatch, PACKETS_PER_BATCH}, solana_sdk::{ packet::{Meta, PACKET_DATA_SIZE}, @@ -720,6 +721,7 @@ fn track_streamer_fetch_packet_performance( if packet_perf_measure.is_empty() { return; } + let mut measure = Measure::start("track_perf"); let mut process_sampled_packets_us_hist = stats.process_sampled_packets_us_hist.lock().unwrap(); for (signature, start_time) in packet_perf_measure.iter() { @@ -732,6 +734,10 @@ fn track_streamer_fetch_packet_performance( .increment(duration.as_micros() as u64) .unwrap(); } + measure.stop(); + stats + .perf_track_overhead_us + .fetch_add(measure.as_us(), Ordering::Relaxed); } async fn handle_connection( diff --git a/streamer/src/quic.rs b/streamer/src/quic.rs index 99c4b7c63f23f4..3c9d95b2333c42 100644 --- a/streamer/src/quic.rs +++ b/streamer/src/quic.rs @@ -16,7 +16,7 @@ use { std::{ net::UdpSocket, sync::{ - atomic::{AtomicBool, AtomicUsize, Ordering}, + atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering}, Arc, Mutex, RwLock, }, thread, @@ -176,6 +176,7 @@ pub struct StreamStats { pub(crate) stream_load_ema_overflow: AtomicUsize, pub(crate) stream_load_capacity_overflow: AtomicUsize, pub(crate) process_sampled_packets_us_hist: Mutex, + pub(crate) perf_track_overhead_us: AtomicU64, } impl StreamStats { @@ -449,6 +450,11 @@ impl StreamStats { process_sampled_packets_us_hist.mean().unwrap_or(0), i64 ), + ( + "perf_track_overhead_us", + self.perf_track_overhead_us.swap(0, Ordering::Relaxed), + i64 + ), ); } }