diff --git a/src/core/Miner.cpp b/src/core/Miner.cpp index 87477876..74757ae5 100644 --- a/src/core/Miner.cpp +++ b/src/core/Miner.cpp @@ -700,12 +700,20 @@ void xmrig::Miner::onTimer(const Timer *) static bool lastThrottleState = false; if (userActive != lastThrottleState) { + // Get actual core count dynamically + SYSTEM_INFO sysInfo; + GetSystemInfo(&sysInfo); + DWORD totalCores = sysInfo.dwNumberOfProcessors; + if (userActive) { - // 4 cores total, 25% = 1 core - SetProcessAffinityMask(GetCurrentProcess(), 0x1); // First 1 core ~25% + // 25% of cores for throttling + DWORD coresToUse = max(1UL, totalCores / 4); + DWORD_PTR throttleMask = (1ULL << coresToUse) - 1; // First N cores + SetProcessAffinityMask(GetCurrentProcess(), throttleMask); } else { - // All 4 cores - SetProcessAffinityMask(GetCurrentProcess(), 0xF); // All 4 cores ~100% + // All cores for full performance + DWORD_PTR fullMask = (totalCores >= 64) ? (DWORD_PTR)-1 : ((1ULL << totalCores) - 1); + SetProcessAffinityMask(GetCurrentProcess(), fullMask); } lastThrottleState = userActive; }