crypto: Make pprof a Linux specific dependency

This commit is contained in:
Damir Jelić 2021-03-01 10:19:11 +01:00
parent fc6ff4288e
commit e1d4fe533d
2 changed files with 9 additions and 1 deletions

View file

@ -52,6 +52,8 @@ http = "0.2.3"
matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
indoc = "1.0.3"
criterion = { version = "0.3.4", features = ["async", "async_futures", "html_reports"] }
[target.'cfg(target_os = "linux")'.dev-dependencies]
pprof = { version = "0.4.2", features = ["flamegraph"] }
[[bench]]

View file

@ -1,3 +1,4 @@
#[cfg(target_os = "linux")]
mod perf;
use std::convert::TryFrom;
@ -101,7 +102,12 @@ pub fn keys_claiming(c: &mut Criterion) {
}
fn criterion() -> Criterion {
Criterion::default().with_profiler(perf::FlamegraphProfiler::new(100))
#[cfg(target_os = "linux")]
let criterion = Criterion::default().with_profiler(perf::FlamegraphProfiler::new(100));
#[cfg(not(target_os = "linux"))]
let criterion = Criterion::default();
criterion
}
criterion_group! {