Skip to content

Commit fee6cbf

Browse files
authored
chore: use pprof in the benchmark for metrics (#51)
## Motivation Use pprof if possible as well as trace benchmark
1 parent e914898 commit fee6cbf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

benches/metrics.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use criterion::{criterion_group, criterion_main, Criterion};
22
use opentelemetry::metrics::noop::NoopMeterProvider;
3+
#[cfg(not(target_os = "windows"))]
4+
use pprof::criterion::{Output, PProfProfiler};
35
use tracing_opentelemetry::MetricsLayer;
46
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
57

@@ -154,6 +156,13 @@ fn metrics_events(c: &mut Criterion) {
154156
group.finish();
155157
}
156158

159+
#[cfg(not(target_os = "windows"))]
160+
criterion_group! {
161+
name = benches;
162+
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
163+
targets = metrics_events
164+
}
165+
#[cfg(target_os = "windows")]
157166
criterion_group! {
158167
name = benches;
159168
config = Criterion::default();

0 commit comments

Comments
 (0)