mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-26 21:00:37 +00:00
coreinit: Fix calculation of thread total awake time
This commit is contained in:
parent
7b513f1744
commit
409f12b13a
@ -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
|
||||
|
||||
// update total cycles
|
||||
uint64 remainingCycles = std::min((uint64)hCPU->remainingCycles, (uint64)thread->quantumTicks);
|
||||
uint64 executedCycles = thread->quantumTicks - remainingCycles;
|
||||
if (executedCycles < hCPU->skippedCycles)
|
||||
sint64 executedCycles = (sint64)thread->quantumTicks - (sint64)hCPU->remainingCycles;
|
||||
executedCycles = std::max<sint64>(executedCycles, 0);
|
||||
if (executedCycles < (sint64)hCPU->skippedCycles)
|
||||
executedCycles = 0;
|
||||
else
|
||||
executedCycles -= hCPU->skippedCycles;
|
||||
thread->totalCycles += executedCycles;
|
||||
thread->totalCycles += (uint64)executedCycles;
|
||||
// store context and set current thread to null
|
||||
__OSThreadStoreContext(hCPU, thread);
|
||||
OSSetCurrentThread(OSGetCoreId(), nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user