From e98584dba7de1e4306cf5176a7482cfe9afd2227 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 18 Nov 2021 18:20:55 +0100 Subject: add a Throughput to the analyzer benchmarks --- benches/analyzers.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/benches/analyzers.rs b/benches/analyzers.rs index 61aee22..2cbb87c 100644 --- a/benches/analyzers.rs +++ b/benches/analyzers.rs @@ -1,4 +1,4 @@ -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput}; use evtclib::Compression; macro_rules! analyzer_benchmark { @@ -7,17 +7,21 @@ macro_rules! analyzer_benchmark { let log = evtclib::process_file($log, Compression::Zip).unwrap(); let analyzer = log.analyzer().unwrap(); - c.bench_function(&format!("analyzers/{}/is_cm", $boss), |b| { + let mut group = c.benchmark_group(&format!("analyzers/{}", $boss)); + group.throughput(Throughput::Elements(1)); + + group.bench_function("is_cm", |b| { b.iter(|| { black_box(analyzer.is_cm()); }) }); - c.bench_function(&format!("analyzers/{}/outcome", $boss), |b| { + group.bench_function("outcome", |b| { b.iter(|| { black_box(analyzer.outcome()); }) }); + group.finish(); } } } -- cgit v1.2.3