Struct datafusion_physical_plan::metrics::Time
source · pub struct Time { /* private fields */ }
Expand description
Measure a potentially non contiguous duration of time
Implementations§
source§impl 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 Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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