From c6b9426d31839a82467186c0b2a44115850e27a4 Mon Sep 17 00:00:00 2001 From: JCW Date: Thu, 11 Sep 2025 08:26:57 +0100 Subject: [PATCH] Performance test Signed-off-by: JCW --- include/xrpl/basics/Log.h | 4 +++- src/libxrpl/basics/Log.cpp | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/xrpl/basics/Log.h b/include/xrpl/basics/Log.h index e2112d2f7f..7c9e566ed4 100644 --- a/include/xrpl/basics/Log.h +++ b/include/xrpl/basics/Log.h @@ -153,10 +153,12 @@ private: // Batching members mutable std::mutex batchMutex_; +public: static constexpr size_t BATCH_BUFFER_SIZE = 64 * 1024; // 64KB buffer std::array batchBuffer_{}; - static thread_local std::span writeBuffer_; // Points to available write space + std::span writeBuffer_; // Points to available write space std::span readBuffer_; // Points to data ready to flush +private: std::chrono::steady_clock::time_point lastFlush_ = std::chrono::steady_clock::now(); diff --git a/src/libxrpl/basics/Log.cpp b/src/libxrpl/basics/Log.cpp index bd5cbd8bf5..7b548fc05a 100644 --- a/src/libxrpl/basics/Log.cpp +++ b/src/libxrpl/basics/Log.cpp @@ -37,7 +37,6 @@ #include namespace ripple { -thread_local std::span Logs::writeBuffer_{}; namespace { constexpr auto FLUSH_INTERVAL = @@ -130,8 +129,8 @@ Logs::File::write(std::string_view text) Logs::Logs(beast::severities::Severity thresh) : thresh_(thresh) // default severity - // , writeBuffer_( - // batchBuffer_) // Initially, entire buffer is available for writing + , writeBuffer_( + batchBuffer_) // Initially, entire buffer is available for writing , readBuffer_(batchBuffer_.data(), 0) // No data ready to flush initially { }