Struct BenchmarkParams
pub struct BenchmarkParams { /* private fields */ }bench only.Expand description
The workload sizes a benchmark run uses, chosen by the caller.
Three numbers, one per scenario, and they are parameters rather than
constants for a reason the first two adapters make concrete: the batch size,
contender count and replay length that say something useful about a Vec
behind an RwLock are not the ones that say something useful about a file
under BEGIN IMMEDIATE. A constant chosen here would be wrong for at least
one of them and unarguable for both.
Implementations§
§impl BenchmarkParams
impl BenchmarkParams
pub const SMOKE: Self
pub const SMOKE: Self
The deliberately tiny budget the one-argument macro arm uses.
Sized to live inside the gate’s ordinary
cargo test --workspace --all-features step rather than to measure
anything: a real number comes from a caller who passed their own
params. Keeping the mounted budget small is what stops an executed
benchmark from becoming a benchmark that gates.
pub const fn new(
batch_size: usize,
contenders: usize,
replay_events: usize,
) -> Self
pub const fn new( batch_size: usize, contenders: usize, replay_events: usize, ) -> Self
Builds a parameter set, refusing a degenerate one by name.
§Panics
Panics if any of batch_size, contenders or replay_events is zero,
naming the offending parameter. The refusal is here, before any store is
reached, because an empty batch is already refused by the contract — and
before the condition is evaluated — so letting one through would turn
a caller’s typo into a benchmark of the error path reported as
throughput. Zero contenders measures no contention, and zero events to
replay measures no replay.
pub const fn batch_size(self) -> usize
pub const fn batch_size(self) -> usize
How many events one append writes — the n of the throughput scenario.
pub const fn contenders(self) -> usize
pub const fn contenders(self) -> usize
How many appends race for one consistency boundary — the k of the contended scenario.
pub const fn replay_events(self) -> usize
pub const fn replay_events(self) -> usize
How many events are seeded before replay — the N of the replay scenario.