Skip to main content

run_benchmark_loop

Function run_benchmark_loop 

Source
pub fn run_benchmark_loop<F>(
    bencher: Bencher,
    runner_fn: F,
    warmup_time_ns: u64,
    measurement_time_ns: u64,
    min_iterations: Option<u64>,
    max_iterations: Option<u64>,
) -> BenchmarkResult
where F: FnMut(&mut Bencher),
Expand description

Run the full benchmark loop: warmup → measurement → finish

This is the shared implementation used by both in-process and isolated execution. Extracts common logic to avoid duplication between worker.rs and executor.rs.

§Arguments

  • bencher - The Bencher instance (takes ownership)
  • runner_fn - Function that calls the benchmark under test
  • warmup_time_ns - How long to run warmup phase (nanoseconds)
  • measurement_time_ns - How long to run measurement phase (nanoseconds)
  • min_iterations - Optional minimum measurement iterations before completion
  • max_iterations - Optional cap on measurement iterations