mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
jemalloc and triomphe
This commit is contained in:
42
Cargo.lock
generated
42
Cargo.lock
generated
@@ -1345,6 +1345,7 @@ dependencies = [
|
|||||||
"fork_choice",
|
"fork_choice",
|
||||||
"fs2",
|
"fs2",
|
||||||
"hex",
|
"hex",
|
||||||
|
"malloc_utils",
|
||||||
"rayon",
|
"rayon",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
@@ -2042,6 +2043,12 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fs_extra"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "funty"
|
name = "funty"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@@ -2766,6 +2773,27 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jemalloc-sys"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"fs_extra",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jemallocator"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
|
||||||
|
dependencies = [
|
||||||
|
"jemalloc-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.55"
|
version = "0.3.55"
|
||||||
@@ -3526,6 +3554,7 @@ dependencies = [
|
|||||||
name = "malloc_utils"
|
name = "malloc_utils"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"jemallocator",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"lighthouse_metrics",
|
"lighthouse_metrics",
|
||||||
@@ -3617,10 +3646,12 @@ dependencies = [
|
|||||||
"derivative",
|
"derivative",
|
||||||
"eth2_hashing 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"eth2_hashing 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"eth2_ssz",
|
"eth2_ssz",
|
||||||
|
"itertools",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"serde",
|
"serde",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"tree_hash",
|
"tree_hash",
|
||||||
|
"triomphe",
|
||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -6373,6 +6404,17 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "triomphe"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c45e322b26410d7260e00f64234810c2f17d7ece356182af4df8f7ff07890f09"
|
||||||
|
dependencies = [
|
||||||
|
"memoffset",
|
||||||
|
"serde",
|
||||||
|
"stable_deref_trait",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "trust-dns-proto"
|
name = "trust-dns-proto"
|
||||||
version = "0.20.3"
|
version = "0.20.3"
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ lighthouse_metrics = { path = "../lighthouse_metrics" }
|
|||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
libc = "0.2.79"
|
libc = "0.2.79"
|
||||||
parking_lot = "0.11.0"
|
parking_lot = "0.11.0"
|
||||||
|
jemallocator = { version = "0.3.0", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
mallinfo2 = []
|
mallinfo2 = []
|
||||||
|
jemalloc = ["jemallocator"]
|
||||||
|
|||||||
2
common/malloc_utils/src/jemalloc.rs
Normal file
2
common/malloc_utils/src/jemalloc.rs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#[global_allocator]
|
||||||
|
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||||
@@ -24,18 +24,27 @@
|
|||||||
//! detecting `glibc` are best-effort. If this crate throws errors about undefined external
|
//! detecting `glibc` are best-effort. If this crate throws errors about undefined external
|
||||||
//! functions, then try to compile with the `not_glibc_interface` module.
|
//! functions, then try to compile with the `not_glibc_interface` module.
|
||||||
|
|
||||||
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
|
#[cfg(all(
|
||||||
|
target_os = "linux",
|
||||||
|
not(any(target_env = "musl", feature = "jemalloc"))
|
||||||
|
))]
|
||||||
mod glibc;
|
mod glibc;
|
||||||
|
|
||||||
|
#[cfg(feature = "jemalloc")]
|
||||||
|
mod jemalloc;
|
||||||
|
|
||||||
pub use interface::*;
|
pub use interface::*;
|
||||||
|
|
||||||
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
|
#[cfg(all(
|
||||||
|
target_os = "linux",
|
||||||
|
not(any(target_env = "musl", feature = "jemalloc"))
|
||||||
|
))]
|
||||||
mod interface {
|
mod interface {
|
||||||
pub use crate::glibc::configure_glibc_malloc as configure_memory_allocator;
|
pub use crate::glibc::configure_glibc_malloc as configure_memory_allocator;
|
||||||
pub use crate::glibc::scrape_mallinfo_metrics as scrape_allocator_metrics;
|
pub use crate::glibc::scrape_mallinfo_metrics as scrape_allocator_metrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(not(target_os = "linux"), target_env = "musl"))]
|
#[cfg(any(not(target_os = "linux"), target_env = "musl", feature = "jemalloc"))]
|
||||||
mod interface {
|
mod interface {
|
||||||
#[allow(dead_code, clippy::unnecessary_wraps)]
|
#[allow(dead_code, clippy::unnecessary_wraps)]
|
||||||
pub fn configure_memory_allocator() -> Result<(), String> {
|
pub fn configure_memory_allocator() -> Result<(), String> {
|
||||||
|
|||||||
@@ -35,3 +35,4 @@ fs2 = "0.4.3"
|
|||||||
beacon_chain = { path = "../../beacon_node/beacon_chain" }
|
beacon_chain = { path = "../../beacon_node/beacon_chain" }
|
||||||
store = { path = "../../beacon_node/store" }
|
store = { path = "../../beacon_node/store" }
|
||||||
fork_choice = { path = "../../consensus/fork_choice" }
|
fork_choice = { path = "../../consensus/fork_choice" }
|
||||||
|
malloc_utils = { path = "../../common/malloc_utils" }
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ mod ssz_static {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
#[test]
|
#[test]
|
||||||
fn ssz_generic() {
|
fn ssz_generic() {
|
||||||
SszGenericHandler::<BasicVector>::default().run();
|
SszGenericHandler::<BasicVector>::default().run();
|
||||||
@@ -314,6 +315,7 @@ fn ssz_generic() {
|
|||||||
SszGenericHandler::<Uints>::default().run();
|
SszGenericHandler::<Uints>::default().run();
|
||||||
SszGenericHandler::<Containers>::default().run();
|
SszGenericHandler::<Containers>::default().run();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn epoch_processing_justification_and_finalization() {
|
fn epoch_processing_justification_and_finalization() {
|
||||||
|
|||||||
Reference in New Issue
Block a user