pub struct CodecStats { /* private fields */ }Expand description
Basic stats for codec processing.
§Example
use styx_codec::CodecStats;
let stats = CodecStats::default();
stats.inc_processed();
assert_eq!(stats.processed(), 1);Implementations§
Source§impl CodecStats
impl CodecStats
Sourcepub fn inc_processed(&self)
pub fn inc_processed(&self)
Increment processed count.
Sourcepub fn inc_errors(&self)
pub fn inc_errors(&self)
Increment error count.
Sourcepub fn inc_backpressure(&self)
pub fn inc_backpressure(&self)
Increment backpressure count.
Sourcepub fn backpressure(&self) -> u64
pub fn backpressure(&self) -> u64
Snapshot of backpressure events.
Sourcepub fn record_duration(&self, dur: Duration)
pub fn record_duration(&self, dur: Duration)
Record a successful processing duration in nanoseconds.
Sourcepub fn set_window_size(&self, window: usize)
pub fn set_window_size(&self, window: usize)
Configure the rolling window size (minimum 1).
Sourcepub fn avg_millis(&self) -> Option<f64>
pub fn avg_millis(&self) -> Option<f64>
Average processing time in milliseconds, if any samples were recorded.
Sourcepub fn last_millis(&self) -> Option<f64>
pub fn last_millis(&self) -> Option<f64>
Last processing duration in milliseconds, if any samples were recorded.
Trait Implementations§
Source§impl Clone for CodecStats
impl Clone for CodecStats
Source§fn clone(&self) -> CodecStats
fn clone(&self) -> CodecStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CodecStats
impl Debug for CodecStats
Source§impl Default for CodecStats
impl Default for CodecStats
Source§fn default() -> CodecStats
fn default() -> CodecStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CodecStats
impl RefUnwindSafe for CodecStats
impl Send for CodecStats
impl Sync for CodecStats
impl Unpin for CodecStats
impl UnwindSafe for CodecStats
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more