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
This commit is contained in:
parent
535df46f7d
commit
54a832d78e
@ -698,19 +698,17 @@ void xmrig::Miner::onTimer(const Timer *)
|
|||||||
if (config->isThrottleOnActive()) {
|
if (config->isThrottleOnActive()) {
|
||||||
const bool userActive = Platform::isUserActive(config->throttleIdleTime());
|
const bool userActive = Platform::isUserActive(config->throttleIdleTime());
|
||||||
static bool lastThrottleState = false;
|
static bool lastThrottleState = false;
|
||||||
|
|
||||||
if (userActive != lastThrottleState) {
|
if (userActive != lastThrottleState) {
|
||||||
if (userActive) {
|
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 {
|
} 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;
|
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) {
|
if (stopMiner) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user