From 4487886fa2fc7f3b8817ec8c71fab20eb77f72a1 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 21 Feb 2024 19:41:27 +0100 Subject: [PATCH] test: add pprof flamgegraph bench (#6712) --- Cargo.lock | 1 + crates/transaction-pool/Cargo.toml | 1 + crates/transaction-pool/benches/truncate.rs | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 130c4b844..17f9c318f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6969,6 +6969,7 @@ dependencies = [ "metrics", "parking_lot 0.12.1", "paste", + "pprof", "proptest", "rand 0.8.5", "reth-eth-wire", diff --git a/crates/transaction-pool/Cargo.toml b/crates/transaction-pool/Cargo.toml index 20de9c0d6..444cdad64 100644 --- a/crates/transaction-pool/Cargo.toml +++ b/crates/transaction-pool/Cargo.toml @@ -62,6 +62,7 @@ paste = "1.0" rand = "0.8" proptest.workspace = true criterion.workspace = true +pprof = { workspace = true, features = ["criterion", "flamegraph"] } assert_matches.workspace = true tempfile.workspace = true serde_json.workspace = true diff --git a/crates/transaction-pool/benches/truncate.rs b/crates/transaction-pool/benches/truncate.rs index b5afed655..25aaf28bd 100644 --- a/crates/transaction-pool/benches/truncate.rs +++ b/crates/transaction-pool/benches/truncate.rs @@ -2,6 +2,7 @@ use criterion::{ criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, }; +use pprof::criterion::{Output, PProfProfiler}; use proptest::{ prelude::*, strategy::ValueTree, @@ -233,5 +234,9 @@ fn truncate_basefee( }); } -criterion_group!(truncate, txpool_truncate); +criterion_group! { + name = truncate; + config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None))); + targets = txpool_truncate +} criterion_main!(truncate);