Skip to main content

Crate fluxbench_core

Crate fluxbench_core 

Source
Expand description

FluxBench Core - Worker Runtime

This crate provides the execution environment for benchmarks:

  • Bencher struct for iteration-based benchmarking
  • Timing: std::time::Instant per 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.
BenchmarkDef
Benchmark definition registered via #[flux::bench]
BenchmarkResult
Result of a single benchmark run
ChartDef
Chart definition registered via #[flux::chart].
CompareDef
Comparison group - groups multiple benchmarks for side-by-side comparison
GroupConfig
Run config a #[flux::group] sets for every benchmark in it and in its child groups.
GroupDef
Group definition registered via #[flux::group].
Instant
High-precision instant for benchmarking
MeasureConfig
Config for one benchmark measurement.
ReportDef
Report definition registered via #[flux::report].
Timer
Timer for measuring benchmark iterations
TrackingAllocator
Tracking allocator that wraps the system allocator
WorkerMain
Worker main loop

Enums§

BatchSize
Inputs per timed batch for iter_batched and iter_batched_ref.
ChartType
Chart kind for #[flux::chart]
IterationMode
Mode of iteration for the benchmark
MeasureError
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::LargeInput batch holds.
MIN_SAMPLE_COUNT
Minimum sample count. Two samples give a defined variance.
SETUP_CHUNK
Most inputs a BatchSize::SmallInput batch holds. iter_with_setup uses it too.

Traits§

SampleSink
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.