pub enum Threshold {
RegressionPct(f64),
RegressionAbsoluteNs(u128),
ThroughputDropPct(f64),
}Expand description
A threshold defining how much slower-than-baseline is acceptable.
Variants§
RegressionPct(f64)
Fail if the new mean is more than pct percent slower than baseline.
RegressionAbsoluteNs(u128)
Fail if current_mean - baseline_mean exceeds nanos.
ThroughputDropPct(f64)
Fail if throughput dropped more than pct percent below baseline.
Baseline ops/sec is derived as 1.0 / baseline_mean_secs, which
assumes the baseline duration is a per-operation duration. Use
with per-iter sampling (Benchmark::iter) where mean equals
per-op duration. For batched sampling
(Benchmark::iter_with_count), prefer a duration-based threshold
or pre-compute the baseline manually.
Implementations§
Source§impl Threshold
impl Threshold
Sourcepub fn regression_pct(pct: f64) -> Self
pub fn regression_pct(pct: f64) -> Self
Build a percent-based duration regression threshold.
§Example
use dev_bench::Threshold;
let t = Threshold::regression_pct(20.0);
assert!(matches!(t, Threshold::RegressionPct(_)));Sourcepub fn regression_abs_ns(nanos: u128) -> Self
pub fn regression_abs_ns(nanos: u128) -> Self
Build an absolute duration regression threshold in nanoseconds.
§Example
use dev_bench::Threshold;
let t = Threshold::regression_abs_ns(500);
assert!(matches!(t, Threshold::RegressionAbsoluteNs(_)));Sourcepub fn throughput_drop_pct(pct: f64) -> Self
pub fn throughput_drop_pct(pct: f64) -> Self
Build a percent-based throughput drop threshold.
§Example
use dev_bench::Threshold;
let t = Threshold::throughput_drop_pct(10.0);
assert!(matches!(t, Threshold::ThroughputDropPct(_)));Trait Implementations§
Auto Trait Implementations§
impl Freeze for Threshold
impl RefUnwindSafe for Threshold
impl Send for Threshold
impl Sync for Threshold
impl Unpin for Threshold
impl UnsafeUnpin for Threshold
impl UnwindSafe for Threshold
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