Skip to content

Commit

Permalink
chore: use pprof only if target_os is not windows (#40)
Browse files Browse the repository at this point in the history
## Motivation

Fix #39

follow up #36 CI
fail

## Solution

add `#[cfg(not(target_os = "windows"))]` condition to pprof dependencies
  • Loading branch information
ymgyt authored Aug 2, 2023
1 parent 76771cf commit d369550
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ async-trait = "0.1.56"
criterion = { version = "0.4.0", default-features = false, features = ["html_reports"] }
opentelemetry-jaeger = "0.19.0"
opentelemetry-stdout = { version = "0.1.0", features = ["trace"] }
pprof = { version = "0.11.1", features = ["flamegraph", "criterion"] }
futures-util = { version = "0.3", default-features = false }
tokio = { version = "1", features = ["full"] }
tokio-stream = "0.1"
tracing = { version = "0.1.35", default-features = false, features = ["std", "attributes"] }

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

[lib]
bench = false

Expand Down
8 changes: 8 additions & 0 deletions benches/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use opentelemetry::{
trace::{SpanBuilder, Tracer as _, TracerProvider as _},
Context,
};
#[cfg(not(target_os = "windows"))]
use pprof::criterion::{Output, PProfProfiler};
use std::time::SystemTime;
use tracing::trace_span;
Expand Down Expand Up @@ -123,9 +124,16 @@ fn tracing_harness() {
dummy();
}

#[cfg(not(target_os = "windows"))]
criterion_group! {
name = benches;
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
targets = many_children
}
#[cfg(target_os = "windows")]
criterion_group! {
name = benches;
config = Criterion::default();
targets = many_children
}
criterion_main!(benches);

0 comments on commit d369550

Please sign in to comment.