From b6292827ef4d3e245cd46355b837d42b539667bc Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:04:09 +0200 Subject: [PATCH 1/5] feat: add support for wrapping the allocator with tracy --- Cargo.lock | 121 ++++++++++++++++++++++++++++--- Cargo.toml | 10 ++- bin/reth-bench/Cargo.toml | 14 ++-- bin/reth-bench/src/main.rs | 12 ++- bin/reth/Cargo.toml | 11 +-- bin/reth/src/lib.rs | 4 - bin/reth/src/main.rs | 17 ++--- crates/cli/util/Cargo.toml | 17 ++++- crates/cli/util/src/allocator.rs | 32 ++++++++ crates/cli/util/src/lib.rs | 2 + crates/node/metrics/Cargo.toml | 3 +- crates/optimism/bin/Cargo.toml | 7 +- crates/optimism/bin/src/main.rs | 4 +- 13 files changed, 196 insertions(+), 58 deletions(-) create mode 100644 crates/cli/util/src/allocator.rs diff --git a/Cargo.lock b/Cargo.lock index 20487d39bc84..5ee1e83f831e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3211,6 +3211,19 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" +[[package]] +name = "generator" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb949699c3e4df3a183b1d2142cb24277057055ed23c68ed58894f76c517223" +dependencies = [ + "cfg-if", + "libc", + "log", + "rustversion", + "windows 0.58.0", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -4548,6 +4561,19 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "loom" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + [[package]] name = "lru" version = "0.12.4" @@ -5160,7 +5186,6 @@ dependencies = [ "reth-optimism-cli", "reth-optimism-rpc", "reth-provider", - "tikv-jemallocator", ] [[package]] @@ -6188,7 +6213,6 @@ dependencies = [ "serde_json", "similar-asserts", "tempfile", - "tikv-jemallocator", "tokio", "tracing", ] @@ -6314,9 +6338,9 @@ dependencies = [ "csv", "eyre", "futures", - "libc", "reqwest", "reth-cli-runner", + "reth-cli-util", "reth-db", "reth-node-api", "reth-node-core", @@ -6328,7 +6352,6 @@ dependencies = [ "serde", "serde_json", "thiserror", - "tikv-jemallocator", "tokio", "tokio-util", "tower 0.4.13", @@ -6512,12 +6535,15 @@ version = "1.0.6" dependencies = [ "alloy-eips", "alloy-primitives", + "cfg-if", "eyre", "libc", "rand 0.8.5", "reth-fs-util", "secp256k1", "thiserror", + "tikv-jemallocator", + "tracy-client", ] [[package]] @@ -9350,6 +9376,12 @@ dependencies = [ "hashbrown 0.13.2", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" @@ -10152,9 +10184,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-ctl" -version = "0.5.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "619bfed27d807b54f7f776b9430d4f8060e66ee138a28632ca898584d462c31c" +checksum = "f21f216790c8df74ce3ab25b534e0718da5a1916719771d3fec23315c99e468b" dependencies = [ "libc", "paste", @@ -10163,9 +10195,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.5.4+5.3.0-patched" +version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" +checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d" dependencies = [ "cc", "libc", @@ -10173,9 +10205,9 @@ dependencies = [ [[package]] name = "tikv-jemallocator" -version = "0.5.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965fe0c26be5c56c94e38ba547249074803efd52adfb66de62107d95aab3eaca" +checksum = "4cec5ff18518d81584f477e9bfdf957f5bb0979b0bac3af4ca30b5b3ae2d2865" dependencies = [ "libc", "tikv-jemalloc-sys", @@ -10574,6 +10606,26 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "tracy-client" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373db47331c3407b343538df77eea2516884a0b126cdfb4b135acfd400015dd7" +dependencies = [ + "loom", + "once_cell", + "tracy-client-sys", +] + +[[package]] +name = "tracy-client-sys" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49cf0064dcb31c99aa1244c1b93439359e53f72ed217eef5db50abd442241e9a" +dependencies = [ + "cc", +] + [[package]] name = "triehash" version = "0.8.4" @@ -11054,6 +11106,16 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -11069,12 +11131,25 @@ version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" dependencies = [ - "windows-implement", - "windows-interface", + "windows-implement 0.57.0", + "windows-interface 0.57.0", "windows-result 0.1.2", "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement 0.58.0", + "windows-interface 0.58.0", + "windows-result 0.2.0", + "windows-strings", + "windows-targets 0.52.6", +] + [[package]] name = "windows-implement" version = "0.57.0" @@ -11086,6 +11161,17 @@ dependencies = [ "syn 2.0.77", ] +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "windows-interface" version = "0.57.0" @@ -11097,6 +11183,17 @@ dependencies = [ "syn 2.0.77", ] +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "windows-registry" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index aca84d6504f3..b302b8930193 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -470,6 +470,7 @@ bitflags = "2.4" boyer-moore-magiclen = "0.2.16" bytes = "1.5" clap = "4" +cfg-if = "1.0" const_format = { version = "0.2.32", features = ["rust_1_64"] } dashmap = "6.0" derive_more = { version = "1", features = ["full"] } @@ -482,7 +483,9 @@ humantime-serde = "1.1" itertools = "0.13" linked_hash_set = "0.1" modular-bitfield = "0.11.2" -notify = { version = "6.1.1", default-features = false, features = ["macos_fsevent"] } +notify = { version = "6.1.1", default-features = false, features = [ + "macos_fsevent", +] } nybbles = "0.2.1" once_cell = "1.19" parking_lot = "0.12" @@ -576,4 +579,7 @@ serial_test = "3" similar-asserts = "1.5.0" tempfile = "3.8" test-fuzz = "5" -tikv-jemallocator = { version = "0.5.0" } + +tikv-jemalloc-ctl = "0.6" +tikv-jemallocator = "0.6" +tracy-client = "0.17.3" diff --git a/bin/reth-bench/Cargo.toml b/bin/reth-bench/Cargo.toml index 4023c1c17375..1b11a4b81bd9 100644 --- a/bin/reth-bench/Cargo.toml +++ b/bin/reth-bench/Cargo.toml @@ -16,6 +16,7 @@ workspace = true # reth reth-provider = { workspace = true } reth-cli-runner.workspace = true +reth-cli-util.workspace = true reth-db = { workspace = true, features = ["mdbx"] } reth-node-core.workspace = true reth-node-api.workspace = true @@ -25,7 +26,10 @@ reth-primitives = { workspace = true, features = ["alloy-compat"] } reth-tracing.workspace = true # alloy -alloy-provider = { workspace = true, features = ["engine-api", "reqwest-rustls-tls"], default-features = false } +alloy-provider = { workspace = true, features = [ + "engine-api", + "reqwest-rustls-tls", +], default-features = false } alloy-rpc-types-engine.workspace = true alloy-transport.workspace = true alloy-transport-http.workspace = true @@ -71,10 +75,6 @@ clap = { workspace = true, features = ["derive", "env"] } # for writing data csv = "1.3.0" -[target.'cfg(unix)'.dependencies] -tikv-jemallocator = { workspace = true, optional = true } -libc = "0.2" - [dev-dependencies] reth-tracing.workspace = true @@ -83,8 +83,8 @@ default = ["jemalloc"] asm-keccak = ["reth-primitives/asm-keccak"] -jemalloc = ["dep:tikv-jemallocator"] -jemalloc-prof = ["jemalloc", "tikv-jemallocator?/profiling"] +jemalloc = ["reth-cli-util/jemalloc"] +jemalloc-prof = ["reth-cli-util/jemalloc-prof"] min-error-logs = ["tracing/release_max_level_error"] min-warn-logs = ["tracing/release_max_level_warn"] diff --git a/bin/reth-bench/src/main.rs b/bin/reth-bench/src/main.rs index 8cb7dbd07b91..c7335961d84a 100644 --- a/bin/reth-bench/src/main.rs +++ b/bin/reth-bench/src/main.rs @@ -3,10 +3,16 @@ //! This is a tool that converts existing blocks into a stream of blocks for benchmarking purposes. //! These blocks are then fed into reth as a stream of execution payloads. -// We use jemalloc for performance reasons. -#[cfg(all(feature = "jemalloc", unix))] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", + html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", + issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" +)] +#![cfg_attr(not(test), warn(unused_crate_dependencies))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + #[global_allocator] -static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; +static ALLOC: reth_cli_util::allocator::Allocator = reth_cli_util::allocator::new_allocator(); pub mod authenticated_transport; pub mod bench; diff --git a/bin/reth/Cargo.toml b/bin/reth/Cargo.toml index 55f45214a1e1..f7bf7bb2dc5e 100644 --- a/bin/reth/Cargo.toml +++ b/bin/reth/Cargo.toml @@ -91,9 +91,6 @@ clap = { workspace = true, features = ["derive", "env"] } backon.workspace = true similar-asserts.workspace = true -[target.'cfg(unix)'.dependencies] -tikv-jemallocator = { workspace = true, optional = true } - [dev-dependencies] reth-discv4.workspace = true tempfile.workspace = true @@ -105,8 +102,12 @@ dev = ["reth-cli-commands/dev"] asm-keccak = ["reth-node-core/asm-keccak", "reth-primitives/asm-keccak"] -jemalloc = ["dep:tikv-jemallocator", "reth-node-core/jemalloc", "reth-node-metrics/jemalloc"] -jemalloc-prof = ["jemalloc", "tikv-jemallocator?/profiling"] +jemalloc = [ + "reth-cli-util/jemalloc", + "reth-node-core/jemalloc", + "reth-node-metrics/jemalloc", +] +jemalloc-prof = ["reth-cli-util/jemalloc"] min-error-logs = ["tracing/release_max_level_error"] min-warn-logs = ["tracing/release_max_level_warn"] diff --git a/bin/reth/src/lib.rs b/bin/reth/src/lib.rs index f1a4d2467608..9d860d3a1b9f 100644 --- a/bin/reth/src/lib.rs +++ b/bin/reth/src/lib.rs @@ -146,7 +146,6 @@ pub mod transaction_pool { /// Re-export of `reth_rpc_*` crates. pub mod rpc { - /// Re-exported from `reth_rpc_builder`. pub mod builder { pub use reth_rpc_builder::*; @@ -190,8 +189,5 @@ pub mod rpc { #[doc(inline)] pub use reth_cli_runner::{tokio_runtime, CliContext, CliRunner}; -#[cfg(all(feature = "jemalloc", unix))] -use tikv_jemallocator as _; - // for rendering diagrams use aquamarine as _; diff --git a/bin/reth/src/main.rs b/bin/reth/src/main.rs index 6952d117b76e..76b4713a3910 100644 --- a/bin/reth/src/main.rs +++ b/bin/reth/src/main.rs @@ -1,12 +1,13 @@ #![allow(missing_docs)] -// We use jemalloc for performance reasons. -#[cfg(all(feature = "jemalloc", unix))] #[global_allocator] -static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; +static ALLOC: reth_cli_util::allocator::Allocator = reth_cli_util::allocator::new_allocator(); -/// clap [Args] for Engine related arguments. -use clap::Args; +use clap::{Args, Parser}; +use reth::{args::utils::DefaultChainSpecParser, cli::Cli}; +use reth_node_builder::EngineNodeLauncher; +use reth_node_ethereum::{node::EthereumAddOns, EthereumNode}; +use reth_provider::providers::BlockchainProvider2; /// Parameters for configuring the engine #[derive(Debug, Clone, Args, PartialEq, Eq, Default)] @@ -18,12 +19,6 @@ pub struct EngineArgs { } fn main() { - use clap::Parser; - use reth::{args::utils::DefaultChainSpecParser, cli::Cli}; - use reth_node_builder::EngineNodeLauncher; - use reth_node_ethereum::{node::EthereumAddOns, EthereumNode}; - use reth_provider::providers::BlockchainProvider2; - reth_cli_util::sigsegv_handler::install(); // Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided. diff --git a/crates/cli/util/Cargo.toml b/crates/cli/util/Cargo.toml index ba090935599b..a8a390e9a2e9 100644 --- a/crates/cli/util/Cargo.toml +++ b/crates/cli/util/Cargo.toml @@ -18,12 +18,21 @@ reth-fs-util.workspace = true alloy-primitives.workspace = true alloy-eips.workspace = true -secp256k1 = { workspace = true, features = ["rand"] } -rand.workspace = true - # misc -thiserror.workspace = true +cfg-if.workspace = true eyre.workspace = true +rand.workspace = true +secp256k1 = { workspace = true, features = ["rand"] } +thiserror.workspace = true + +tracy-client = { workspace = true, optional = true } [target.'cfg(unix)'.dependencies] +tikv-jemallocator = { workspace = true, optional = true } libc = "0.2" + +[features] +jemalloc = ["dep:tikv-jemallocator"] +jemalloc-prof = ["jemalloc", "tikv-jemallocator?/profiling"] + +tracy-allocator = ["dep:tracy-client"] diff --git a/crates/cli/util/src/allocator.rs b/crates/cli/util/src/allocator.rs new file mode 100644 index 000000000000..d9fb6d524307 --- /dev/null +++ b/crates/cli/util/src/allocator.rs @@ -0,0 +1,32 @@ +//! Custom allocator implementation. + +// We use jemalloc for performance reasons. +cfg_if::cfg_if! { + if #[cfg(all(feature = "jemalloc", unix))] { + type AllocatorInner = tikv_jemallocator::Jemalloc; + } else { + type AllocatorInner = std::alloc::System; + } +} + +cfg_if::cfg_if! { + if #[cfg(feature = "tracy-allocator")] { + type AllocatorWrapper = tracing_tracy::client::ProfiledAllocator; + const fn new_allocator_wrapper() -> AllocatorWrapper { + AllocatorWrapper::new(AllocatorInner {}, 100) + } + } else { + type AllocatorWrapper = AllocatorInner; + const fn new_allocator_wrapper() -> AllocatorWrapper { + AllocatorInner {} + } + } +} + +/// Custom allocator. +pub type Allocator = AllocatorWrapper; + +/// Creates a new [custom allocator][Allocator]. +pub const fn new_allocator() -> Allocator { + new_allocator_wrapper() +} diff --git a/crates/cli/util/src/lib.rs b/crates/cli/util/src/lib.rs index fd43f1b489f2..a5bc2452fe3f 100644 --- a/crates/cli/util/src/lib.rs +++ b/crates/cli/util/src/lib.rs @@ -8,6 +8,8 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] +pub mod allocator; + /// Helper function to load a secret key from a file. pub mod load_secret_key; pub use load_secret_key::get_secret_key; diff --git a/crates/node/metrics/Cargo.toml b/crates/node/metrics/Cargo.toml index b43d40252108..153036d34fb7 100644 --- a/crates/node/metrics/Cargo.toml +++ b/crates/node/metrics/Cargo.toml @@ -28,7 +28,7 @@ tracing.workspace = true eyre.workspace = true [target.'cfg(unix)'.dependencies] -tikv-jemalloc-ctl = { version = "0.5.0", optional = true } +tikv-jemalloc-ctl = { workspace = true, optional = true, features = ["stats"] } [target.'cfg(target_os = "linux")'.dependencies] procfs = "0.16.0" @@ -45,6 +45,5 @@ workspace = true [features] jemalloc = ["dep:tikv-jemalloc-ctl"] - [build-dependencies] vergen = { version = "8.0.0", features = ["build", "cargo", "git", "gitcl"] } diff --git a/crates/optimism/bin/Cargo.toml b/crates/optimism/bin/Cargo.toml index 9c34b5a7b0b7..cbcc8fcf6b25 100644 --- a/crates/optimism/bin/Cargo.toml +++ b/crates/optimism/bin/Cargo.toml @@ -18,17 +18,14 @@ reth-node-optimism.workspace = true clap = { workspace = true, features = ["derive", "env"] } -[target.'cfg(unix)'.dependencies] -tikv-jemallocator = { workspace = true, optional = true } - [lints] workspace = true [features] default = ["jemalloc"] -jemalloc = ["dep:tikv-jemallocator"] -jemalloc-prof = ["jemalloc", "tikv-jemallocator?/profiling"] +jemalloc = ["reth-cli-util/jemalloc"] +jemalloc-prof = ["reth-cli-util/jemalloc-prof"] asm-keccak = ["reth-optimism-cli/asm-keccak", "reth-node-optimism/asm-keccak"] diff --git a/crates/optimism/bin/src/main.rs b/crates/optimism/bin/src/main.rs index 3f66a38510e0..86cdc3929b1c 100644 --- a/crates/optimism/bin/src/main.rs +++ b/crates/optimism/bin/src/main.rs @@ -10,10 +10,8 @@ use reth_optimism_cli::{chainspec::OpChainSpecParser, Cli}; use reth_optimism_rpc::eth::rpc::SequencerClient; use reth_provider::providers::BlockchainProvider2; -// We use jemalloc for performance reasons -#[cfg(all(feature = "jemalloc", unix))] #[global_allocator] -static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; +static ALLOC: reth_cli_util::allocator::Allocator = reth_cli_util::allocator::new_allocator(); fn main() { reth_cli_util::sigsegv_handler::install(); From c8a60915a108a6c6330061094789b9ce6b605d15 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:09:08 +0200 Subject: [PATCH 2/5] chore: propagate the feature --- bin/reth-bench/Cargo.toml | 1 + bin/reth/Cargo.toml | 1 + crates/optimism/bin/Cargo.toml | 1 + 3 files changed, 3 insertions(+) diff --git a/bin/reth-bench/Cargo.toml b/bin/reth-bench/Cargo.toml index 1b11a4b81bd9..ec2c050d298b 100644 --- a/bin/reth-bench/Cargo.toml +++ b/bin/reth-bench/Cargo.toml @@ -85,6 +85,7 @@ asm-keccak = ["reth-primitives/asm-keccak"] jemalloc = ["reth-cli-util/jemalloc"] jemalloc-prof = ["reth-cli-util/jemalloc-prof"] +tracy-allocator = ["reth-cli-util/tracy-allocator"] min-error-logs = ["tracing/release_max_level_error"] min-warn-logs = ["tracing/release_max_level_warn"] diff --git a/bin/reth/Cargo.toml b/bin/reth/Cargo.toml index f7bf7bb2dc5e..11d1c79242df 100644 --- a/bin/reth/Cargo.toml +++ b/bin/reth/Cargo.toml @@ -108,6 +108,7 @@ jemalloc = [ "reth-node-metrics/jemalloc", ] jemalloc-prof = ["reth-cli-util/jemalloc"] +tracy-allocator = ["reth-cli-util/tracy-allocator"] min-error-logs = ["tracing/release_max_level_error"] min-warn-logs = ["tracing/release_max_level_warn"] diff --git a/crates/optimism/bin/Cargo.toml b/crates/optimism/bin/Cargo.toml index cbcc8fcf6b25..eee07c0be876 100644 --- a/crates/optimism/bin/Cargo.toml +++ b/crates/optimism/bin/Cargo.toml @@ -26,6 +26,7 @@ default = ["jemalloc"] jemalloc = ["reth-cli-util/jemalloc"] jemalloc-prof = ["reth-cli-util/jemalloc-prof"] +tracy-allocator = ["reth-cli-util/tracy-allocator"] asm-keccak = ["reth-optimism-cli/asm-keccak", "reth-node-optimism/asm-keccak"] From b330878e9535192efc31923dddfc8872102f050b Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:18:35 +0200 Subject: [PATCH 3/5] fix --- crates/cli/util/src/allocator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli/util/src/allocator.rs b/crates/cli/util/src/allocator.rs index d9fb6d524307..ddd8955e8589 100644 --- a/crates/cli/util/src/allocator.rs +++ b/crates/cli/util/src/allocator.rs @@ -11,7 +11,7 @@ cfg_if::cfg_if! { cfg_if::cfg_if! { if #[cfg(feature = "tracy-allocator")] { - type AllocatorWrapper = tracing_tracy::client::ProfiledAllocator; + type AllocatorWrapper = tracy_client::ProfiledAllocator; const fn new_allocator_wrapper() -> AllocatorWrapper { AllocatorWrapper::new(AllocatorInner {}, 100) } From 2a7f38a255e8172d5af863477739918f9d2e6a7f Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Fri, 13 Sep 2024 10:34:34 +0200 Subject: [PATCH 4/5] feat: enable demangle feature --- Cargo.lock | 12 +++--------- bin/reth-bench/Cargo.toml | 11 +---------- crates/cli/util/Cargo.toml | 2 +- crates/cli/util/src/allocator.rs | 3 +++ 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ee1e83f831e..05ea324e1d77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6322,7 +6322,6 @@ dependencies = [ name = "reth-bench" version = "1.0.6" dependencies = [ - "alloy-consensus", "alloy-eips", "alloy-json-rpc", "alloy-provider", @@ -6341,19 +6340,15 @@ dependencies = [ "reqwest", "reth-cli-runner", "reth-cli-util", - "reth-db", "reth-node-api", "reth-node-core", "reth-primitives", - "reth-provider", "reth-rpc-types", "reth-rpc-types-compat", "reth-tracing", "serde", - "serde_json", "thiserror", "tokio", - "tokio-util", "tower 0.4.13", "tracing", ] @@ -10609,19 +10604,18 @@ dependencies = [ [[package]] name = "tracy-client" version = "0.17.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373db47331c3407b343538df77eea2516884a0b126cdfb4b135acfd400015dd7" +source = "git+https://github.com/danipopes/rust_tracy_client?branch=custom-demangler#36655950b6a68d40e8b946bd0cdfb55efcd4d701" dependencies = [ "loom", "once_cell", + "rustc-demangle", "tracy-client-sys", ] [[package]] name = "tracy-client-sys" version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49cf0064dcb31c99aa1244c1b93439359e53f72ed217eef5db50abd442241e9a" +source = "git+https://github.com/danipopes/rust_tracy_client?branch=custom-demangler#36655950b6a68d40e8b946bd0cdfb55efcd4d701" dependencies = [ "cc", ] diff --git a/bin/reth-bench/Cargo.toml b/bin/reth-bench/Cargo.toml index ec2c050d298b..e4a532a2cc2a 100644 --- a/bin/reth-bench/Cargo.toml +++ b/bin/reth-bench/Cargo.toml @@ -14,10 +14,8 @@ workspace = true [dependencies] # reth -reth-provider = { workspace = true } reth-cli-runner.workspace = true reth-cli-util.workspace = true -reth-db = { workspace = true, features = ["mdbx"] } reth-node-core.workspace = true reth-node-api.workspace = true reth-rpc-types.workspace = true @@ -38,7 +36,6 @@ alloy-transport-ipc.workspace = true alloy-pubsub.workspace = true alloy-json-rpc.workspace = true alloy-rpc-client.workspace = true -alloy-consensus.workspace = true alloy-eips.workspace = true # reqwest @@ -54,7 +51,6 @@ tracing.workspace = true # io serde.workspace = true -serde_json.workspace = true # async tokio = { workspace = true, features = [ @@ -63,7 +59,6 @@ tokio = { workspace = true, features = [ "time", "rt-multi-thread", ] } -tokio-util.workspace = true futures.workspace = true async-trait.workspace = true @@ -93,11 +88,7 @@ min-info-logs = ["tracing/release_max_level_info"] min-debug-logs = ["tracing/release_max_level_debug"] min-trace-logs = ["tracing/release_max_level_trace"] -optimism = [ - "reth-primitives/optimism", - "reth-provider/optimism", - "reth-node-core/optimism", -] +optimism = ["reth-primitives/optimism", "reth-node-core/optimism"] # no-op feature flag for switching between the `optimism` and default functionality in CI matrices ethereum = [] diff --git a/crates/cli/util/Cargo.toml b/crates/cli/util/Cargo.toml index a8a390e9a2e9..d96a882a672a 100644 --- a/crates/cli/util/Cargo.toml +++ b/crates/cli/util/Cargo.toml @@ -25,7 +25,7 @@ rand.workspace = true secp256k1 = { workspace = true, features = ["rand"] } thiserror.workspace = true -tracy-client = { workspace = true, optional = true } +tracy-client = { workspace = true, optional = true, features = ["demangle"] } [target.'cfg(unix)'.dependencies] tikv-jemallocator = { workspace = true, optional = true } diff --git a/crates/cli/util/src/allocator.rs b/crates/cli/util/src/allocator.rs index ddd8955e8589..b5974e2245f8 100644 --- a/crates/cli/util/src/allocator.rs +++ b/crates/cli/util/src/allocator.rs @@ -23,6 +23,9 @@ cfg_if::cfg_if! { } } +#[cfg(feature = "tracy-allocator")] +tracy_client::register_demangler!(); + /// Custom allocator. pub type Allocator = AllocatorWrapper; From 9b70784cf5e7153d907bcaba3d7e55bdad52e1c7 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:48:17 +0200 Subject: [PATCH 5/5] chore: lockfile --- Cargo.lock | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 05ea324e1d77..5bf7bf8fc9d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10604,7 +10604,8 @@ dependencies = [ [[package]] name = "tracy-client" version = "0.17.3" -source = "git+https://github.com/danipopes/rust_tracy_client?branch=custom-demangler#36655950b6a68d40e8b946bd0cdfb55efcd4d701" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373db47331c3407b343538df77eea2516884a0b126cdfb4b135acfd400015dd7" dependencies = [ "loom", "once_cell", @@ -10615,7 +10616,8 @@ dependencies = [ [[package]] name = "tracy-client-sys" version = "0.24.0" -source = "git+https://github.com/danipopes/rust_tracy_client?branch=custom-demangler#36655950b6a68d40e8b946bd0cdfb55efcd4d701" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49cf0064dcb31c99aa1244c1b93439359e53f72ed217eef5db50abd442241e9a" dependencies = [ "cc", ]