[−][src]Struct dipstick::Timer
A timer that sends values to the metrics backend Timers can record time intervals in multiple ways :
- with the time! macrohich wraps an expression or block with start() and stop() calls.
- with the time(Fn) methodhich wraps a closure with start() and stop() calls.
- with start() and stop() methodsrapping around the operation to time
- with the interval_us() method, providing an externally determined microsecond interval
Implementations
impl Timer
[src]
pub fn interval_us(&self, interval_us: u64) -> u64
[src]
Record a microsecond interval for this timer Can be used in place of start()/stop() if an external time interval source is used
pub fn start(&self) -> TimeHandle
[src]
Obtain a opaque handle to the current time. The handle is passed back to the stop() method to record a time interval. This is actually a convenience method to the TimeHandle::now() Beware, handles obtained here are not bound to this specific timer instance for now but might be in the future for safety. If you require safe multi-timer handles, get them through TimeType::now()
pub fn stop(&self, start_time: TimeHandle) -> MetricValue
[src]
Record the time elapsed since the start_time handle was obtained. This call can be performed multiple times using the same handle, reporting distinct time intervals each time. Returns the microsecond interval value that was recorded.
pub fn time<F: FnOnce() -> R, R>(&self, operations: F) -> R
[src]
Record the time taken to execute the provided closure
Methods from Deref<Target = InputMetric>
pub fn write(&self, value: MetricValue, labels: Labels)
[src]
Collect a new value for this metric.
pub fn metric_id(&self) -> &MetricId
[src]
Returns the unique identifier of this metric.
Trait Implementations
impl Clone for Timer
[src]
impl Debug for Timer
[src]
impl Deref for Timer
[src]
type Target = InputMetric
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl From<InputMetric> for Timer
[src]
fn from(metric: InputMetric) -> Timer
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,