pub struct StatsCollector { /* private fields */ }Expand description
Lock-free accumulator of query and insert statistics.
All counters use Relaxed ordering for throughput; the last_query_ns
field uses Release/Acquire so that a reader who observes an updated
timestamp also sees the corresponding counter increments.
Implementations§
Source§impl StatsCollector
impl StatsCollector
Sourcepub fn record_insert(&self)
pub fn record_insert(&self)
Record a completed insert.
Sourcepub fn record_query(&self, latency_ns: u64)
pub fn record_query(&self, latency_ns: u64)
Record a completed query with the given latency.
Sourcepub fn query_count(&self) -> u64
pub fn query_count(&self) -> u64
Total number of queries recorded.
Sourcepub fn insert_count(&self) -> u64
pub fn insert_count(&self) -> u64
Total number of inserts recorded.
Sourcepub fn mean_query_ns(&self) -> u64
pub fn mean_query_ns(&self) -> u64
Mean query latency in nanoseconds, or 0 if no queries have been
recorded.
Sourcepub fn last_query_ns(&self) -> Option<u64>
pub fn last_query_ns(&self) -> Option<u64>
Nanoseconds since the epoch at which the last query was recorded, or
None if no queries have been recorded yet.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for StatsCollector
impl RefUnwindSafe for StatsCollector
impl Send for StatsCollector
impl Sync for StatsCollector
impl Unpin for StatsCollector
impl UnsafeUnpin for StatsCollector
impl UnwindSafe for StatsCollector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more