From 0dc0bc42ba21478f1da065b35d42c2eb76b82226 Mon Sep 17 00:00:00 2001 From: JCW Date: Wed, 28 May 2025 15:42:28 +0100 Subject: [PATCH] Test --- include/xrpl/beast/core/FunctionProfiler.h | 2 +- include/xrpl/beast/hash/xxhasher.h | 32 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/xrpl/beast/core/FunctionProfiler.h b/include/xrpl/beast/core/FunctionProfiler.h index 6e7025dbb9..81fe38630e 100644 --- a/include/xrpl/beast/core/FunctionProfiler.h +++ b/include/xrpl/beast/core/FunctionProfiler.h @@ -94,7 +94,7 @@ getProfilingResults() << timeInTotal / (double)duration.time.size() << "," << compute_stddev(times) << "," << cpuCyclesInTotal / (double)duration.cpuCycles.size() << "," - << compute_stddev(duration.cpuCycles) << "," + << compute_stddev(duration.cpuCycles) << std::endl; } diff --git a/include/xrpl/beast/hash/xxhasher.h b/include/xrpl/beast/hash/xxhasher.h index b62af9907a..3a77f40f49 100644 --- a/include/xrpl/beast/hash/xxhasher.h +++ b/include/xrpl/beast/hash/xxhasher.h @@ -53,8 +53,8 @@ private: } }; - XXH3_state_t* state_; - // inline static thread_local state_wrapper wrapper{}; + // XXH3_state_t* state_; + inline static thread_local state_wrapper wrapper{}; std::size_t totalSize_ = 0; std::chrono::nanoseconds duration_{}; std::uint64_t cpuCycles = 0; @@ -82,9 +82,9 @@ public: { auto start = std::chrono::steady_clock::now(); auto cpuCyclesStart = __rdtsc(); - state_ = allocState(); - XXH3_64bits_reset(state_); - // XXH3_64bits_reset(wrapper.state); + // state_ = allocState(); + // XXH3_64bits_reset(state_); + XXH3_64bits_reset(wrapper.state); duration_ += std::chrono::steady_clock::now() - start; cpuCycles += (__rdtsc() - cpuCyclesStart); } @@ -93,7 +93,7 @@ public: { // profiler_.functionName = "xxhasher-" + std::to_string(totalSize_); // auto start = std::chrono::steady_clock::now(); - // if (0) + if (0) { FunctionProfiler _{"-free"}; XXH3_freeState(state_); @@ -107,9 +107,9 @@ public: { auto start = std::chrono::steady_clock::now(); auto cpuCyclesStart = __rdtsc(); - state_ = allocState(); - XXH3_64bits_reset_withSeed(state_, seed); - // XXH3_64bits_reset_withSeed(wrapper.state, seed); + // state_ = allocState(); + // XXH3_64bits_reset_withSeed(state_, seed); + XXH3_64bits_reset_withSeed(wrapper.state, seed); duration_ += std::chrono::steady_clock::now() - start; cpuCycles += (__rdtsc() - cpuCyclesStart); } @@ -121,9 +121,9 @@ public: { auto start = std::chrono::steady_clock::now(); auto cpuCyclesStart = __rdtsc(); - state_ = allocState(); - XXH3_64bits_reset_withSeed(state_, seed); - // XXH3_64bits_reset_withSeed(wrapper.state, seed); + // state_ = allocState(); + // XXH3_64bits_reset_withSeed(state_, seed); + XXH3_64bits_reset_withSeed(wrapper.state, seed); duration_ += std::chrono::steady_clock::now() - start; cpuCycles += (__rdtsc() - cpuCyclesStart); } @@ -135,8 +135,8 @@ public: auto cpuCyclesStart = __rdtsc(); totalSize_ += len; // FunctionProfiler _{"-size-" + std::to_string(len)}; - XXH3_64bits_update(state_, key, len); - // XXH3_64bits_update(wrapper.state, key, len); + // XXH3_64bits_update(state_, key, len); + XXH3_64bits_update(wrapper.state, key, len); duration_ += std::chrono::steady_clock::now() - start; cpuCycles += (__rdtsc() - cpuCyclesStart); } @@ -145,8 +145,8 @@ public: operator std::size_t() noexcept { auto start = std::chrono::steady_clock::now(); - auto ret = XXH3_64bits_digest(state_); - // auto ret = XXH3_64bits_digest(wrapper.state); + // auto ret = XXH3_64bits_digest(state_); + auto ret = XXH3_64bits_digest(wrapper.state); duration_ += std::chrono::steady_clock::now() - start; std::lock_guard lock{FunctionProfiler::mutex_};