From 695fbc013baed8d8d09d866de326025a5227f0c7 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 25 Apr 2021 15:28:45 +0700 Subject: [PATCH] #2280 Disable GPU backends in benchmark mode. --- src/base/net/stratum/Pools.h | 6 ++++++ src/core/config/Config.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/base/net/stratum/Pools.h b/src/base/net/stratum/Pools.h index 7fa6ec9d5..a6ae965b2 100644 --- a/src/base/net/stratum/Pools.h +++ b/src/base/net/stratum/Pools.h @@ -57,6 +57,12 @@ public: Pools(); +# ifdef XMRIG_FEATURE_BENCHMARK + inline bool isBenchmark() const { return !!m_benchmark; } +# else + inline constexpr bool isBenchmark() const { return false; } +# endif + inline const std::vector &data() const { return m_data; } inline int retries() const { return m_retries; } inline int retryPause() const { return m_retryPause; } diff --git a/src/core/config/Config.cpp b/src/core/config/Config.cpp index 3924123f0..fa5760185 100644 --- a/src/core/config/Config.cpp +++ b/src/core/config/Config.cpp @@ -225,11 +225,15 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName) # endif # ifdef XMRIG_FEATURE_OPENCL - d_ptr->cl.read(reader.getValue(kOcl)); + if (!pools().isBenchmark()) { + d_ptr->cl.read(reader.getValue(kOcl)); + } # endif # ifdef XMRIG_FEATURE_CUDA - d_ptr->cuda.read(reader.getValue(kCuda)); + if (!pools().isBenchmark()) { + d_ptr->cuda.read(reader.getValue(kCuda)); + } # endif # if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)