Quic client stats (#24195)
* Add metrics to connection-cache to measure cache hits and misses * Add congestion stats * Add more client stats * Review comments Co-authored-by: Ryan Leung <ryan.leung@solana.com>
This commit is contained in:
@ -4,7 +4,28 @@ pub mod datapoint;
|
||||
mod metrics;
|
||||
pub mod poh_timing_point;
|
||||
pub use crate::metrics::{flush, query, set_host_id, set_panic_hook, submit};
|
||||
use std::sync::Arc;
|
||||
use std::sync::{
|
||||
atomic::{AtomicU64, Ordering},
|
||||
Arc,
|
||||
};
|
||||
|
||||
// To track an external counter which cannot be reset and is always increasing
|
||||
#[derive(Default)]
|
||||
pub struct MovingStat {
|
||||
value: AtomicU64,
|
||||
}
|
||||
|
||||
impl MovingStat {
|
||||
pub fn update_stat(&self, old_value: &MovingStat, new_value: u64) {
|
||||
let old = old_value.value.swap(new_value, Ordering::Acquire);
|
||||
self.value
|
||||
.fetch_add(new_value.saturating_sub(old), Ordering::Release);
|
||||
}
|
||||
|
||||
pub fn load_and_reset(&self) -> u64 {
|
||||
self.value.swap(0, Ordering::Acquire)
|
||||
}
|
||||
}
|
||||
|
||||
/// A helper that sends the count of created tokens as a datapoint.
|
||||
#[allow(clippy::redundant_allocation)]
|
||||
|
Reference in New Issue
Block a user