mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-01-09 11:17:30 -03:00
coreinit: Fix calculation of thread total awake time
This commit is contained in:
parent
7b513f1744
commit
409f12b13a
1 changed files with 4 additions and 4 deletions
|
@ -1114,13 +1114,13 @@ namespace coreinit
|
||||||
thread->requestFlags = (OSThread_t::REQUEST_FLAG_BIT)(thread->requestFlags & OSThread_t::REQUEST_FLAG_CANCEL); // remove all flags except cancel flag
|
thread->requestFlags = (OSThread_t::REQUEST_FLAG_BIT)(thread->requestFlags & OSThread_t::REQUEST_FLAG_CANCEL); // remove all flags except cancel flag
|
||||||
|
|
||||||
// update total cycles
|
// update total cycles
|
||||||
uint64 remainingCycles = std::min((uint64)hCPU->remainingCycles, (uint64)thread->quantumTicks);
|
sint64 executedCycles = (sint64)thread->quantumTicks - (sint64)hCPU->remainingCycles;
|
||||||
uint64 executedCycles = thread->quantumTicks - remainingCycles;
|
executedCycles = std::max<sint64>(executedCycles, 0);
|
||||||
if (executedCycles < hCPU->skippedCycles)
|
if (executedCycles < (sint64)hCPU->skippedCycles)
|
||||||
executedCycles = 0;
|
executedCycles = 0;
|
||||||
else
|
else
|
||||||
executedCycles -= hCPU->skippedCycles;
|
executedCycles -= hCPU->skippedCycles;
|
||||||
thread->totalCycles += executedCycles;
|
thread->totalCycles += (uint64)executedCycles;
|
||||||
// store context and set current thread to null
|
// store context and set current thread to null
|
||||||
__OSThreadStoreContext(hCPU, thread);
|
__OSThreadStoreContext(hCPU, thread);
|
||||||
OSSetCurrentThread(OSGetCoreId(), nullptr);
|
OSSetCurrentThread(OSGetCoreId(), nullptr);
|
||||||
|
|
Loading…
Reference in a new issue