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§
Source§impl Timer
impl Timer
Sourcepub fn new_with<R>(reservoir: R, clock: Arc<dyn Clock>) -> Timerwhere
R: Reservoir,
pub fn new_with<R>(reservoir: R, clock: Arc<dyn Clock>) -> Timerwhere
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 !Freeze for Timer
impl !RefUnwindSafe for Timer
impl Send for Timer
impl Sync for Timer
impl Unpin for Timer
impl !UnwindSafe for Timer
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