pub struct AbsoluteThresholds {
pub max_p99_wake_latency_ns: Option<u64>,
pub max_iteration_cost_p99_ns: Option<u64>,
pub max_migrations: Option<u64>,
pub min_work_units: Option<u64>,
}Expand description
Threshold-preset bundle for assert_thresholds. Captures the
guarantees a scheduler-under-test should meet on a healthy run:
wake latency stays within bound, per-iteration compute cost stays
within bound, CPU migrations stay within bound, and every worker
makes some forward progress.
Each Option field is independent — None skips that check. A
AbsoluteThresholds with every field None is a no-op (the
returned AssertResult always passes), useful as a starting
point for builder-style composition. Construct the all-None
thresholds via AbsoluteThresholds::default() and chain the
max_* / min_* setters (e.g. AbsoluteThresholds::default().max_migrations(5))
or spread into a struct literal (AbsoluteThresholds { max_migrations: Some(5), ..Default::default() }).
Use Self::strict for the “every check enabled with sane defaults” preset.
Distinct from Assert: Assert is the merge-tree threshold
config consumed by the worker-side AssertPlan; AbsoluteThresholds
is a flat preset designed for direct invocation in test bodies
where the test author wants a one-call multi-field check without
engaging the merge chain. The two surfaces compose — a test can
run assert_thresholds against a worker-report slice AND merge the
Assert-derived result into the same accumulator via
AssertResult::merge.
Fields§
§max_p99_wake_latency_ns: Option<u64>Maximum acceptable p99 wake latency (nanoseconds). Compared
against the pooled p99 across every worker’s
WorkerReport::wake_latencies_ns. None skips the check.
Same units / semantics as Assert::max_p99_wake_latency_ns.
max_iteration_cost_p99_ns: Option<u64>Maximum acceptable p99 per-iteration compute cost (nanoseconds).
Compared against the pooled p99 across every worker’s
WorkerReport::iteration_costs_ns. None skips the check.
Only meaningful for compute work types that populate the
reservoir (AluHot, SmtSiblingSpin, IpcVariance); blocking
variants report empty iteration_costs_ns and the check is a
no-op for those.
max_migrations: Option<u64>Maximum acceptable total CPU migrations across every worker.
Compared against the sum of WorkerReport::migration_count.
None skips the check. Distinct from
Assert::max_migration_ratio (migrations per iteration) —
this is an absolute count, useful when the test pins a known
workload size and migrations should stay below a fixed ceiling
regardless of how many iterations completed.
min_work_units: Option<u64>Minimum acceptable per-worker work_units. Every worker must
have completed at least this many work units; one below-floor
worker fails the check. None skips. Distinct from
assert_not_stuck’s zero-work-units check, which gates
only against literal zero — this gate accepts a non-zero
floor so a test can reject “barely made progress” runs that
pass the strict zero-work-units gate.
Implementations§
Source§impl AbsoluteThresholds
impl AbsoluteThresholds
Sourcepub const fn strict() -> Self
pub const fn strict() -> Self
Sane-default preset: p99 wake latency under 10ms, p99 iteration cost under 1ms, total migrations under 1000, every worker completes ≥1 work unit. The defaults are deliberately loose — a threshold set tight enough to catch egregious regressions without flagging every routine scheduler perturbation. Tests that need tighter bounds should set the fields explicitly via the bare-verb builder methods rather than tuning these constants.
Sourcepub const fn max_p99_wake_latency_ns(self, v: u64) -> Self
pub const fn max_p99_wake_latency_ns(self, v: u64) -> Self
Builder setter for Self::max_p99_wake_latency_ns.
Sourcepub const fn max_iteration_cost_p99_ns(self, v: u64) -> Self
pub const fn max_iteration_cost_p99_ns(self, v: u64) -> Self
Builder setter for Self::max_iteration_cost_p99_ns.
Sourcepub const fn max_migrations(self, v: u64) -> Self
pub const fn max_migrations(self, v: u64) -> Self
Builder setter for Self::max_migrations.
Sourcepub const fn min_work_units(self, v: u64) -> Self
pub const fn min_work_units(self, v: u64) -> Self
Builder setter for Self::min_work_units.
Trait Implementations§
Source§impl Clone for AbsoluteThresholds
impl Clone for AbsoluteThresholds
Source§fn clone(&self) -> AbsoluteThresholds
fn clone(&self) -> AbsoluteThresholds
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AbsoluteThresholds
impl Debug for AbsoluteThresholds
Source§impl Default for AbsoluteThresholds
impl Default for AbsoluteThresholds
Source§fn default() -> AbsoluteThresholds
fn default() -> AbsoluteThresholds
impl Copy for AbsoluteThresholds
Auto Trait Implementations§
impl Freeze for AbsoluteThresholds
impl RefUnwindSafe for AbsoluteThresholds
impl Send for AbsoluteThresholds
impl Sync for AbsoluteThresholds
impl Unpin for AbsoluteThresholds
impl UnwindSafe for AbsoluteThresholds
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more