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) {