Skip to content

Commit

Permalink
Enable jemalloc profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleiserson committed Dec 17, 2024
1 parent abff373 commit 11010e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ipa-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ enable-benches = ["cli", "in-memory-infra", "test-fixture", "criterion", "iai"]
in-memory-infra = []
real-world-infra = []
# Force use of jemalloc on non-Linux platforms. jemalloc is used by default on Linux.
jemalloc = ["tikv-jemallocator", "tikv-jemalloc-ctl"]
jemalloc = ["jemalloc_pprof", "tikv-jemallocator", "tikv-jemalloc-ctl"]
dhat-heap = ["cli", "dhat", "test-fixture"]
# Enable this feature to enable our colossally weak Fp31.
weak-field = []
Expand Down Expand Up @@ -148,6 +148,7 @@ subtle = "2.6"
thiserror = "1.0"
tikv-jemallocator = { version = "0.6", optional = true, features = ["profiling"] }
tikv-jemalloc-ctl = { version = "0.6", optional = true, features = ["stats"] }
jemalloc_pprof = { version = "0.6", optional = true }
time = { version = "0.3", optional = true }
tokio = { version = "1.42", features = ["fs", "rt", "rt-multi-thread", "macros"] }
tokio-rustls = { version = "0.26", optional = true }
Expand All @@ -164,6 +165,7 @@ x25519-dalek = "2.0.0-rc.3"
[target.'cfg(all(not(target_env = "msvc"), not(target_os = "macos")))'.dependencies]
tikv-jemallocator = { version = "0.6", features = ["profiling"] }
tikv-jemalloc-ctl = { version = "0.6", features = ["stats"] }
jemalloc_pprof = { version = "0.6" }

[build-dependencies]
cfg_aliases = "0.1.1"
Expand Down
5 changes: 5 additions & 0 deletions ipa-core/src/bin/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ use tracing::{error, info};
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

#[cfg(jemalloc)]
#[allow(non_upper_case_globals)]
#[export_name = "_rjem_malloc_conf"]
pub static _rjem_malloc_conf: &[u8] = b"prof:true,prof_active:true\0";

#[cfg(feature = "dhat-heap")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;
Expand Down

0 comments on commit 11010e2

Please sign in to comment.