Skip to content

Commit

Permalink
Disable pprof on winodws
Browse files Browse the repository at this point in the history
  • Loading branch information
infogulch committed Nov 15, 2023
1 parent 9770080 commit 846d281
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ maplit = "1.0.2"
serial_test = "2.0.0"
iai-callgrind = "0.7.3"
criterion = "0.5.1"

[target.'cfg(not(target_os = "windows"))'.dev-dependencies]
pprof = { version = "0.13.0", features = ["criterion", "flamegraph"] }

[patch.crates-io]
Expand Down
16 changes: 15 additions & 1 deletion benches/run_criterion.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};

#[cfg(not(target_os = "windows"))]
use pprof::criterion::{Output, PProfProfiler};

mod setup;
Expand All @@ -14,9 +16,21 @@ fn bench_criterion(c: &mut Criterion) {
}
}

#[cfg(not(target_os = "windows"))]
fn config() -> Criterion {
Criterion::default()
.sample_size(20)
.with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)))
}

#[cfg(target_os = "windows")]
fn config() -> Criterion {
Criterion::default().sample_size(20)
}

criterion_group!(
name = bench_group;
config = Criterion::default().sample_size(20).with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
config = config();
targets = bench_criterion
);
criterion_main!(bench_group);

0 comments on commit 846d281

Please sign in to comment.