Skip to content

Commit f5f898b

Browse files
authored
Enable flame graphs and reports for benchmarks (#27)
In order to more easily interpret benchmark data, I enabled criterion HTML reports and flame graphs.
1 parent 040c57a commit f5f898b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ thiserror = { version = "1.0.31", optional = true }
3838

3939
[dev-dependencies]
4040
async-trait = "0.1.56"
41-
criterion = { version = "0.5.0", default-features = false }
41+
criterion = { version = "0.4.0", default-features = false, features = ["html_reports"] }
4242
opentelemetry-jaeger = "0.18.0"
43+
pprof = { version = "0.11.1", features = ["flamegraph", "criterion"] }
4344
futures-util = { version = "0.3", default-features = false }
4445
tokio = { version = "1", features = ["full"] }
4546
tokio-stream = "0.1"

benches/trace.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use opentelemetry::{
44
trace::{SpanBuilder, Tracer as _, TracerProvider as _},
55
Context,
66
};
7+
use pprof::criterion::{Output, PProfProfiler};
78
use std::time::SystemTime;
89
use tracing::trace_span;
910
use tracing_subscriber::prelude::*;
@@ -122,5 +123,9 @@ fn tracing_harness() {
122123
dummy();
123124
}
124125

125-
criterion_group!(benches, many_children);
126+
criterion_group! {
127+
name = benches;
128+
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
129+
targets = many_children
130+
}
126131
criterion_main!(benches);

0 commit comments

Comments
 (0)