Skip to content

Commit

Permalink
Enable flame graphs and reports for benchmarks (#27)
Browse files Browse the repository at this point in the history
In order to more easily interpret benchmark data, I enabled criterion
HTML reports and flame graphs.
  • Loading branch information
shaun-cox committed Jun 24, 2023
1 parent 040c57a commit f5f898b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ thiserror = { version = "1.0.31", optional = true }

[dev-dependencies]
async-trait = "0.1.56"
criterion = { version = "0.5.0", default-features = false }
criterion = { version = "0.4.0", default-features = false, features = ["html_reports"] }
opentelemetry-jaeger = "0.18.0"
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"
Expand Down
7 changes: 6 additions & 1 deletion 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,
};
use pprof::criterion::{Output, PProfProfiler};
use std::time::SystemTime;
use tracing::trace_span;
use tracing_subscriber::prelude::*;
Expand Down Expand Up @@ -122,5 +123,9 @@ fn tracing_harness() {
dummy();
}

criterion_group!(benches, many_children);
criterion_group! {
name = benches;
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
targets = many_children
}
criterion_main!(benches);

0 comments on commit f5f898b

Please sign in to comment.