Compare commits

...

2 Commits

Author SHA1 Message Date
g-ripple
997d066b65 Merge otel-phase10 (all otel-phase changes) into perf/allocator-benchmark-notrim 2026-07-10 14:38:09 +00:00
g-ripple
162093680b perf: allocator benchmark build (glibc/jemalloc/tcmalloc) with malloc_trim disabled
- Add tcmalloc (gperftools) option to conanfile.py + cmake wiring
- Extend gold-linker carveout for tcmalloc
- Disable proactive mallocTrim() in doSweep for allocator benchmarking
2026-07-10 14:38:04 +00:00
5 changed files with 22 additions and 2 deletions

View File

@@ -242,7 +242,7 @@ elseif(use_gold AND is_gcc)
disabling would be to figure out all the settings
required to make gold play nicely with jemalloc.
#]=========================================================]
if(("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc))
if(("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc) AND (NOT tcmalloc))
target_link_libraries(
common
INTERFACE

View File

@@ -54,6 +54,11 @@ if(jemalloc)
target_link_libraries(opts INTERFACE jemalloc::jemalloc)
endif()
if(tcmalloc)
find_package(gperftools REQUIRED)
target_link_libraries(opts INTERFACE gperftools::gperftools)
endif()
#[===================================================================[
xrpld transitive library deps via an interface library
#]===================================================================]

View File

@@ -125,6 +125,10 @@ else()
endif()
option(jemalloc "Enables jemalloc for heap profiling" OFF)
option(tcmalloc "Link xrpld against tcmalloc (gperftools) as the global allocator" OFF)
if(jemalloc AND tcmalloc)
message(FATAL_ERROR "jemalloc and tcmalloc are mutually exclusive")
endif()
option(werr "treat warnings as errors" OFF)
option(
local_protobuf

View File

@@ -3,6 +3,7 @@ import re
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
class Xrpl(ConanFile):
@@ -21,6 +22,7 @@ class Xrpl(ConanFile):
"rocksdb": [True, False],
"shared": [True, False],
"static": [True, False],
"tcmalloc": [True, False],
"telemetry": [True, False],
"tests": [True, False],
"unity": [True, False],
@@ -53,6 +55,7 @@ class Xrpl(ConanFile):
"rocksdb": True,
"shared": False,
"static": True,
"tcmalloc": False,
"telemetry": True,
"tests": False,
"unity": False,
@@ -125,6 +128,10 @@ class Xrpl(ConanFile):
self.version = match.group(1)
def configure(self):
if self.options.tcmalloc and self.options.jemalloc:
raise ConanInvalidConfiguration(
"jemalloc and tcmalloc cannot both be enabled"
)
if self.settings.compiler == "apple-clang":
self.options["boost"].visibility = "global"
if self.settings.compiler in ["clang", "gcc"]:
@@ -135,6 +142,8 @@ class Xrpl(ConanFile):
self.requires("date/3.0.4", transitive_headers=True)
if self.options.jemalloc:
self.requires("jemalloc/5.3.1")
if self.options.tcmalloc:
self.requires("gperftools/2.16")
self.requires("lz4/1.10.0", force=True)
self.requires("mpt-crypto/0.4.0-rc2", transitive_headers=True)
self.requires("protobuf/6.33.5", force=True)
@@ -171,6 +180,7 @@ class Xrpl(ConanFile):
tc.variables["assert"] = self.options.assertions
tc.variables["coverage"] = self.options.coverage
tc.variables["jemalloc"] = self.options.jemalloc
tc.variables["tcmalloc"] = self.options.tcmalloc
tc.variables["rocksdb"] = self.options.rocksdb
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
tc.variables["static"] = self.options.static

View File

@@ -1129,7 +1129,8 @@ public:
<< "; size after: " << cachedSLEs_.size();
}
mallocTrim("doSweep", journal_);
// Disabled for allocator benchmark: no proactive malloc_trim on sweep.
// mallocTrim("doSweep", journal_);
// Set timer to do another sweep later.
setSweepTimer();