From 54a832d78e5a340131b826520c2cc20a336b9eba Mon Sep 17 00:00:00 2001 From: JorySeverijnse Date: Sat, 13 Dec 2025 19:58:18 +0100 Subject: [PATCH] Fix throttling logic - active=25% CPU, inactive=100% CPU - Active user: SetProcessAffinityMask(0x3) - 2 cores ~25% CPU - Inactive user: SetProcessAffinityMask(-1) - all cores ~100% CPU - Removed broken Worker.cpp modifications - Simple process-level affinity control --- src/core/Miner.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/core/Miner.cpp b/src/core/Miner.cpp index 3bb69997..ff32ea03 100644 --- a/src/core/Miner.cpp +++ b/src/core/Miner.cpp @@ -698,19 +698,17 @@ void xmrig::Miner::onTimer(const Timer *) if (config->isThrottleOnActive()) { const bool userActive = Platform::isUserActive(config->throttleIdleTime()); static bool lastThrottleState = false; - + if (userActive != lastThrottleState) { if (userActive) { - LOG_INFO("%s " YELLOW_BOLD("user active - enabling throttling"), Tags::miner()); + LOG_INFO("%s " YELLOW_BOLD("user active - throttling to 25% CPU"), Tags::miner()); + SetProcessAffinityMask(GetCurrentProcess(), 0x3); // First 2 cores ~25% } else { - LOG_INFO("%s " GREEN_BOLD("user inactive - disabling throttling"), Tags::miner()); + LOG_INFO("%s " GREEN_BOLD("user inactive - using 100% CPU"), Tags::miner()); + SetProcessAffinityMask(GetCurrentProcess(), (DWORD_PTR)-1); // All cores } lastThrottleState = userActive; } - - // Set global throttling state for workers - extern void setThrottlingState(bool throttled, uint64_t originalAffinity); - setThrottlingState(userActive, 0); // Workers will handle their own affinity } if (stopMiner) {