From e1d4fe533d0709980af76cd5ed0cafd3160a33a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 1 Mar 2021 10:19:11 +0100 Subject: [PATCH] crypto: Make pprof a Linux specific dependency --- matrix_sdk_crypto/Cargo.toml | 2 ++ matrix_sdk_crypto/benches/crypto_bench.rs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/matrix_sdk_crypto/Cargo.toml b/matrix_sdk_crypto/Cargo.toml index 99d35532..15bcf1e2 100644 --- a/matrix_sdk_crypto/Cargo.toml +++ b/matrix_sdk_crypto/Cargo.toml @@ -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]] diff --git a/matrix_sdk_crypto/benches/crypto_bench.rs b/matrix_sdk_crypto/benches/crypto_bench.rs index e715dd92..dabc7918 100644 --- a/matrix_sdk_crypto/benches/crypto_bench.rs +++ b/matrix_sdk_crypto/benches/crypto_bench.rs @@ -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! {