feat: add support for wrapping the allocator with tracy (#10874)

This commit is contained in:
DaniPopes
2024-09-13 18:12:33 +02:00
committed by GitHub
parent 12e8af4a24
commit 87e5e0929f
13 changed files with 204 additions and 73 deletions

View File

@@ -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,13 @@ 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"]
tracy-allocator = ["reth-cli-util/tracy-allocator"]
min-error-logs = ["tracing/release_max_level_error"]
min-warn-logs = ["tracing/release_max_level_warn"]

View File

@@ -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 _;

View File

@@ -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.