| 1 |
use criterion::{criterion_group, Criterion, SamplingMode}; |
| 2 |
use std::thread::sleep; |
| 3 |
use std::time::Duration; |
| 4 |
|
| 5 |
fn sampling_mode_tests(c: &mut Criterion) { |
| 6 |
let mut group = c.benchmark_group("sampling_mode"); |
| 7 |
|
| 8 |
group.sampling_mode(SamplingMode::Auto); |
| 9 |
group.bench_function("Auto", |bencher| { |
| 10 |
bencher.iter(|| sleep(Duration::from_millis(0))); |
| 11 |
}); |
| 12 |
|
| 13 |
group.sampling_mode(SamplingMode::Linear); |
| 14 |
group.bench_function("Linear", |bencher| { |
| 15 |
bencher.iter(|| sleep(Duration::from_millis(0))); |
| 16 |
}); |
| 17 |
|
| 18 |
group.sampling_mode(SamplingMode::Flat); |
| 19 |
group.bench_function("Flat", |bencher| { |
| 20 |
bencher.iter(|| sleep(Duration::from_millis(10))); |
| 21 |
}); |
| 22 |
|
| 23 |
group.finish(); |
| 24 |
} |
| 25 |
|
| 26 |
criterion_group!(benches, sampling_mode_tests,); |