Struct datafusion::physical_plan::metrics::Time
source · [−]pub struct Time { /* private fields */ }
Expand description
Measure a potentially non contiguous duration of time
Implementations
sourceimpl Time
impl Time
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Time
wrapper suitable for recording elapsed
times for operations.
sourcepub fn add_elapsed(&self, start: Instant)
pub fn add_elapsed(&self, start: Instant)
Add elapsed nanoseconds since start
to self
sourcepub fn add_duration(&self, duration: Duration)
pub fn add_duration(&self, duration: Duration)
Add duration of time to self
Note: this will always increment the recorded time by at least 1 nanosecond to distinguish between the scenario of no values recorded, in which case the value will be 0, and no measurable amount of time having passed, in which case the value will be small but not 0.
This is based on the assumption that the timing logic in most cases is likely to take at least a nanosecond, and so this is reasonable mechanism to avoid ambiguity, especially on systems with low-resolution monotonic clocks
sourcepub fn timer(&self) -> ScopedTimerGuard<'_>
pub fn timer(&self) -> ScopedTimerGuard<'_>
return a scoped guard that adds the amount of time elapsed
between its creation and its drop or call to stop
to the
underlying metric.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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