Struct witchcraft_metrics::Timer
source · [−]pub struct Timer { /* private fields */ }
Expand description
A metric tracking the duration and rate of events.
The timer’s default reservoir implementation (used by its Default
implementation) is the
ExponentiallyDecayingReservoir
.
Implementations
sourceimpl Timer
impl Timer
sourcepub fn new_with<R>(reservoir: R, clock: Arc<dyn Clock>) -> Self where
R: Reservoir,
pub fn new_with<R>(reservoir: R, clock: Arc<dyn Clock>) -> Self where
R: Reservoir,
Creates a new timer using the provided Clock
as its time source.
sourcepub fn time(&self) -> Time<'_>
pub fn time(&self) -> Time<'_>
Returns a guard type which reports the time elapsed since its creation when it drops.
sourcepub fn one_minute_rate(&self) -> f64
pub fn one_minute_rate(&self) -> f64
Returns the one minute rolling average rate of the occurrence of events measured in events per second.
sourcepub fn five_minute_rate(&self) -> f64
pub fn five_minute_rate(&self) -> f64
Returns the five minute rolling average rate of the occurrence of events measured in events per second.
sourcepub fn fifteen_minute_rate(&self) -> f64
pub fn fifteen_minute_rate(&self) -> f64
Returns the fifteen minute rolling average rate of the occurrence of events measured in events per second.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Timer
impl Send for Timer
impl Sync for Timer
impl Unpin for Timer
impl !UnwindSafe for Timer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more