From 2972172a055131defd0c2207af7ccd8828cbf098 Mon Sep 17 00:00:00 2001 From: JorySeverijnse Date: Sat, 13 Dec 2025 18:25:14 +0100 Subject: [PATCH] Fix throttling sleep placement to after hashing work - Move sleep from before hashing to after hashing completion - Increase sleep to 300ms to achieve ~25% CPU usage - This ensures actual work gets done before throttling delay - Sleep now happens after m_count increment where hashing is complete --- src/backend/cpu/CpuWorker.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/cpu/CpuWorker.cpp b/src/backend/cpu/CpuWorker.cpp index 9cd2292b..a1a19d3e 100644 --- a/src/backend/cpu/CpuWorker.cpp +++ b/src/backend/cpu/CpuWorker.cpp @@ -288,13 +288,6 @@ void xmrig::CpuWorker::start() } } - // Apply timing-based throttling when user is active - // This reduces effective hashrate to ~25% by adding delays - if (m_isThrottled) { - // Sleep for 75% of the time to achieve ~25% CPU usage - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - const Job &job = m_job.currentJob(); if (job.algorithm().l3() != m_algorithm.l3()) { @@ -389,6 +382,13 @@ void xmrig::CpuWorker::start() m_count += N; } + // Apply timing-based throttling when user is active + // This reduces effective hashrate to ~25% by adding delays after hashing + if (m_isThrottled) { + // Sleep for ~300ms to achieve ~25% CPU usage (hash takes ~100ms, so 300ms sleep = 25% usage) + std::this_thread::sleep_for(std::chrono::milliseconds(300)); + } + if (m_yield) { std::this_thread::yield(); }