Expand description
FluxBench Core - Worker Runtime
This crate provides the execution environment for benchmarks:
Bencherstruct for iteration-based benchmarking- Timing:
std::time::Instantper timed region, with the empty-timer overhead subtracted. Cycle counts come from RDTSCP (x86_64) or CNTVCT_EL0 (aarch64), and are 0 elsewhere - Global allocator interceptor for memory tracking
- CPU affinity pinning for stable cycle-counter readings
The async feature (default) adds iter_async and drive_async_body on tokio.
Without it, the crate has no tokio dependency.
Structs§
- Bencher
- The Bencher provides iteration control for benchmarks.
- Benchmark
Def - Benchmark definition registered via
#[flux::bench] - Benchmark
Result - Result of a single benchmark run
- Chart
Def - Chart definition registered via
#[flux::chart]. - Compare
Def - Comparison group - groups multiple benchmarks for side-by-side comparison
- Group
Config - Run config a
#[flux::group]sets for every benchmark in it and in its child groups. - Group
Def - Group definition registered via
#[flux::group]. - Instant
- High-precision instant for benchmarking
- Measure
Config - Config for one benchmark measurement.
- Report
Def - Report definition registered via
#[flux::report]. - Timer
- Timer for measuring benchmark iterations
- Tracking
Allocator - Tracking allocator that wraps the system allocator
- Worker
Main - Worker main loop
Enums§
- Batch
Size - Inputs per timed batch for
iter_batchedanditer_batched_ref. - Chart
Type - Chart kind for
#[flux::chart] - Iteration
Mode - Mode of iteration for the benchmark
- Measure
Error - Error from one benchmark measurement.
- Severity
- Severity levels for CI integration
- Throughput
- Work one routine call processes.
Constants§
- DEFAULT_
SAMPLE_ COUNT - Default number of samples to collect (matches Criterion)
- HAS_
CYCLE_ COUNTER - Whether this platform provides hardware cycle counters (x86_64 RDTSCP or AArch64 CNTVCT_EL0).
When
false, cycle counts are reported as 0 and only wall-clock nanoseconds are available. Whether this platform provides real cycle counters. - LARGE_
INPUT_ CHUNK - Most inputs a
BatchSize::LargeInputbatch holds. - MIN_
SAMPLE_ COUNT - Minimum sample count. Two samples give a defined variance.
- SETUP_
CHUNK - Most inputs a
BatchSize::SmallInputbatch holds.iter_with_setupuses it too.
Traits§
- Sample
Sink - Receives each measurement sample when the engine records it.
Functions§
- current_
allocation - Get current allocation statistics
- cycles_
overhead - Cycles one empty timer pair costs. It is 0 without a cycle counter.
- drive_
async_ body - Run an async benchmark body to completion on
rt. Its output is dropped. - reset_
allocation_ counter - Reset allocation counters (call before each iteration)
- run_
benchmark_ loop - Run one benchmark body and return its result.
- timer_
overhead_ ns - Nanoseconds one empty timer pair costs.