pub fn run_benchmark(spec: BenchSpec) -> Result<RunnerReport, BenchError>Available on crate feature
full only.Expand description
Runs a benchmark by name
Looks up the benchmark function in the registry and executes it with the given specification. The benchmark’s runner handles all timing, including any setup/teardown logic.
§Arguments
spec- Benchmark specification including function name, iterations, and warmup
§Returns
Ok(BenchReport)- Report containing timing samplesErr(BenchError)- If the function is not found or execution fails
§Example
ⓘ
use mobench_sdk::{BenchSpec, run_benchmark};
let spec = BenchSpec {
name: "my_benchmark".to_string(),
iterations: 100,
warmup: 10,
};
let report = run_benchmark(spec)?;
println!("Mean: {} ns", report.mean());