assert_thresholds

Function assert_thresholds 

Source
pub fn assert_thresholds(
    reports: &[WorkerReport],
    thresholds: &AbsoluteThresholds,
) -> AssertResult
Expand description

Run every check in thresholds against reports, merging results into a single AssertResult. A None field on the thresholds skips that check.

An empty reports slice short-circuits to a skip ("no worker reports to evaluate") regardless of thresholds content — silently passing thresholds against zero samples would let them look “green” on a run that produced no measurement.

Field-to-check mapping:

  • max_p99_wake_latency_ns -> pooled p99 across every worker’s wake_latencies_ns; tagged DetailKind::Benchmark.
  • max_iteration_cost_p99_ns -> pooled p99 across every worker’s iteration_costs_ns; tagged DetailKind::Benchmark.
  • max_migrations -> sum of migration_count across workers; tagged DetailKind::Migration.
  • min_work_units -> per-worker work_units >= floor; tagged DetailKind::NoProgress when a worker is below the floor.

The wake-latency check delegates to assert_benchmarks for the percentile path so the same nearest-rank algorithm applies; the iteration-cost check uses an inline percentile call against the pooled iteration_costs_ns reservoir.

// Strict preset on a healthy run — passes.
let r = assert_thresholds(&[report], &AbsoluteThresholds::strict());
assert!(r.is_pass());