pub trait Regression: Benchmark<Output: for<'a> Deserialize<'a>> {
type Tolerances: Input + 'static;
type Pass: Serialize + Display + 'static;
type Fail: Serialize + Display + 'static;
// Required method
fn check(
&self,
tolerances: &Self::Tolerances,
input: &Self::Input,
before: &Self::Output,
after: &Self::Output,
) -> Result<PassFail<Self::Pass, Self::Fail>>;
}Expand description
A refinement of Benchmark, that supports before/after comparison of generated results.
Benchmarks are associated with a “tolerance” input, which may contain runtime values controlling the amount of slack a benchmark is allowed to have between runs before failing.
The semantics of pass or failure are left solely to the discretion of the Regression
implementation.
See: register_regression.
Required Associated Types§
Sourcetype Tolerances: Input + 'static
type Tolerances: Input + 'static
The tolerance Input associated with this regression check.
Required Methods§
Sourcefn check(
&self,
tolerances: &Self::Tolerances,
input: &Self::Input,
before: &Self::Output,
after: &Self::Output,
) -> Result<PassFail<Self::Pass, Self::Fail>>
fn check( &self, tolerances: &Self::Tolerances, input: &Self::Input, before: &Self::Output, after: &Self::Output, ) -> Result<PassFail<Self::Pass, Self::Fail>>
Run any regression checks necessary for two benchmark runs before and after.
Argument tolerances contain any tuned runtime tolerances to use when determining
whether or not a regression is detected.
The input is the raw input that would have been provided to Benchmark::run
when generating the before and after outputs.
Implementations of check should not attempt to print to stdout or any other
stream. Instead, all diagnostics should be encoded in the returned PassFail type
for reporting upstream.