Struct criterion_perf_events::Perf
source · pub struct Perf { /* private fields */ }
Expand description
perf
implements criterion::measurement::Measurement
so it can be used in criterion to measure perf events.
Create a struct via Perf::new()
.
Implementations§
source§impl Perf
impl Perf
sourcepub fn new(builder: PerfCounterBuilderLinux) -> Perf
pub fn new(builder: PerfCounterBuilderLinux) -> Perf
Creates a new criterion measurement plugin that measures perf events.
Argument
builder
- A PerfCounterBuilderLinux from the crate perfcnt that is configured for the selected counter.
Remarks
Should only fail if you select a counter that is not available on your system or you do not have the necessarry access rights.
Trait Implementations§
source§impl Measurement for Perf
impl Measurement for Perf
§type Intermediate = u64
type Intermediate = u64
This type represents an intermediate value for the measurements. It will be produced by the
start function and passed to the end function. An example might be the wall-clock time as
of the
start
call.§type Value = u64
type Value = u64
This type is the measured value. An example might be the elapsed wall-clock time between the
start
and end
calls.source§fn start(&self) -> Self::Intermediate
fn start(&self) -> Self::Intermediate
Criterion.rs will call this before iterating the benchmark.
source§fn end(&self, _i: Self::Intermediate) -> Self::Value
fn end(&self, _i: Self::Intermediate) -> Self::Value
Criterion.rs will call this after iterating the benchmark to get the measured value.
source§fn add(&self, v1: &Self::Value, v2: &Self::Value) -> Self::Value
fn add(&self, v1: &Self::Value, v2: &Self::Value) -> Self::Value
Combine two values. Criterion.rs sometimes needs to perform measurements in multiple batches
of iterations, so the value from one batch must be added to the sum of the previous batches.
source§fn zero(&self) -> Self::Value
fn zero(&self) -> Self::Value
Return a “zero” value for the Value type which can be added to another value.
source§fn to_f64(&self, value: &Self::Value) -> f64
fn to_f64(&self, value: &Self::Value) -> f64
Converts the measured value to f64 so that it can be used in statistical analysis.
source§fn formatter(&self) -> &dyn ValueFormatter
fn formatter(&self) -> &dyn ValueFormatter
Return a trait-object reference to the value formatter for this measurement.
Auto Trait Implementations§
impl !RefUnwindSafe for Perf
impl Send for Perf
impl !Sync for Perf
impl Unpin for Perf
impl UnwindSafe for Perf
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