pub struct MeasureRegion { /* private fields */ }
Expand description
Measure code block performance by collecting samples. It relies on the fact that objects get destroyed at the end of the block.
let mut loop_timing = MeasureRegion::new();
for _ in 0..N {
let _ = loop_timing.get_sample();
foo();
}
let cpu_cycles = loop_timing.get_average_sample() *
CPUInfo::get_frequency_hz().tsc_scaling;
Implementations§
Source§impl MeasureRegion
impl MeasureRegion
pub fn new_named(region_name: String, dump_on_drop: bool) -> Self
pub fn new() -> Self
pub fn get_sample(&mut self) -> MeasureSample<'_>
pub fn get_average_sample(&self) -> f32
Sourcepub fn get_total_time(&self) -> u64
pub fn get_total_time(&self) -> u64
Get total running time in milliseconds
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MeasureRegion
impl RefUnwindSafe for MeasureRegion
impl Send for MeasureRegion
impl Sync for MeasureRegion
impl Unpin for MeasureRegion
impl UnwindSafe for MeasureRegion
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
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>
Converts
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>
Converts
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