pub struct RegressionConfig(/* private fields */);
Expand description

Configure performance regression checks and behavior

A performance regression check consists of an EventKind and a percentage over which a regression is assumed. If the percentage is negative, then a regression is assumed to be below this limit. The default EventKind is EventKind::EstimatedCycles with a value of +10f64

If fail_fast is set to true, then the whole benchmark run fails on the first encountered regression. Else, the default behavior is, that the benchmark run fails with a regression error after all benchmarks have been run.

Examples

use iai_callgrind::{main, LibraryBenchmarkConfig, RegressionConfig};
main!(
    config = LibraryBenchmarkConfig::default()
                .regression(RegressionConfig::default());
    library_benchmark_groups = some_group
);

Implementations§

source§

impl RegressionConfig

Enable performance regression checks with a RegressionConfig

A performance regression check consists of an EventKind and a percentage over which a regression is assumed. If the percentage is negative, then a regression is assumed to be below this limit. The default EventKind is EventKind::EstimatedCycles with a value of +10f64

If fail_fast is set to true, then the whole benchmark run fails on the first encountered regression. Else, the default behavior is, that the benchmark run fails with a regression error after all benchmarks have been run.

Examples

use iai_callgrind::{LibraryBenchmarkConfig, RegressionConfig};

main!(
    config = LibraryBenchmarkConfig::default()
                .regression(RegressionConfig::default());
    library_benchmark_groups = some_group
);
source

pub fn limits<T>(&mut self, targets: T) -> &mut Self
where T: IntoIterator<Item = (EventKind, f64)>,

Configure the limits percentages over/below which a performance regression can be assumed

A performance regression check consists of an EventKind and a percentage over which a regression is assumed. If the percentage is negative, then a regression is assumed to be below this limit.

If no limits or empty targets are specified with this function, the default EventKind is EventKind::EstimatedCycles with a value of +10f64

Examples
use iai_callgrind::{EventKind, RegressionConfig};

let config = RegressionConfig::default().limits([(EventKind::Ir, 5f64)]);
source

pub fn fail_fast(&mut self, value: bool) -> &mut Self

If set to true, then the benchmarks fail on the first encountered regression

The default is false and the whole benchmark run fails with a regression error after all benchmarks have been run.

Examples
use iai_callgrind::RegressionConfig;

let config = RegressionConfig::default().fail_fast(true);

Trait Implementations§

source§

impl AsRef<RegressionConfig> for RegressionConfig

source§

fn as_ref(&self) -> &RegressionConfig

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for RegressionConfig

source§

fn clone(&self) -> RegressionConfig

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RegressionConfig

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for RegressionConfig

source§

fn default() -> RegressionConfig

Returns the “default value” for a type. Read more
source§

impl From<&RegressionConfig> for InternalRegressionConfig

source§

fn from(value: &RegressionConfig) -> Self

Converts to this type from the input type.
source§

impl From<&mut RegressionConfig> for InternalRegressionConfig

source§

fn from(value: &mut RegressionConfig) -> Self

Converts to this type from the input type.
source§

impl From<RegressionConfig> for InternalRegressionConfig

source§

fn from(value: RegressionConfig) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.