crypto: Make pprof a Linux specific dependency

master
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" } matrix-sdk-test = { version = "0.2.0", path = "../matrix_sdk_test" }
indoc = "1.0.3" indoc = "1.0.3"
criterion = { version = "0.3.4", features = ["async", "async_futures", "html_reports"] } 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"] } pprof = { version = "0.4.2", features = ["flamegraph"] }
[[bench]] [[bench]]

View File

@ -1,3 +1,4 @@
#[cfg(target_os = "linux")]
mod perf; mod perf;
use std::convert::TryFrom; use std::convert::TryFrom;
@ -101,7 +102,12 @@ pub fn keys_claiming(c: &mut Criterion) {
} }
fn criterion() -> 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! { criterion_group! {