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
This commit is contained in:
parent
5f9c1bd885
commit
2972172a05
@ -288,13 +288,6 @@ void xmrig::CpuWorker<N>::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();
|
const Job &job = m_job.currentJob();
|
||||||
|
|
||||||
if (job.algorithm().l3() != m_algorithm.l3()) {
|
if (job.algorithm().l3() != m_algorithm.l3()) {
|
||||||
@ -389,6 +382,13 @@ void xmrig::CpuWorker<N>::start()
|
|||||||
m_count += N;
|
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) {
|
if (m_yield) {
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user