diff options
author | Daniel Schadt <kingdread@gmx.de> | 2021-11-18 18:20:55 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2021-11-18 18:20:55 +0100 |
commit | e98584dba7de1e4306cf5176a7482cfe9afd2227 (patch) | |
tree | b4206ffc667408dee3d56ff0010e232a722b8135 /benches | |
parent | 44a7ff8badf109cf18d3cac29122a8df09966761 (diff) | |
download | evtclib-e98584dba7de1e4306cf5176a7482cfe9afd2227.tar.gz evtclib-e98584dba7de1e4306cf5176a7482cfe9afd2227.tar.bz2 evtclib-e98584dba7de1e4306cf5176a7482cfe9afd2227.zip |
add a Throughput to the analyzer benchmarks
Diffstat (limited to 'benches')
-rw-r--r-- | benches/analyzers.rs | 10 |
1 files 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(); } } } |