Account for delays between calls to KiClockIsr

This fixes the slowness in the dashboard
This commit is contained in:
ergo720 2023-03-12 11:20:39 +01:00
parent 32b4393085
commit b72cfaa909
3 changed files with 6 additions and 6 deletions

View File

@ -103,7 +103,7 @@ static uint64_t pit_next(uint64_t now)
uint64_t next = pit_last + pit_period;
if (now >= next) {
xbox::KiClockIsr();
xbox::KiClockIsr((now - pit_last - pit_period) / 1000);
pit_last = get_now();
return pit_period;
}

View File

@ -145,7 +145,7 @@ xbox::void_xt xbox::KiWaitListUnlock()
KiWaitListMtx.Mtx.unlock();
}
xbox::void_xt xbox::KiClockIsr()
xbox::void_xt xbox::KiClockIsr(ulonglong_xt ExtraMs)
{
KIRQL OldIrql;
LARGE_INTEGER InterruptTime, SystemTime;
@ -157,7 +157,7 @@ xbox::void_xt xbox::KiClockIsr()
// Update the interrupt time
InterruptTime.u.LowPart = KeInterruptTime.LowPart;
InterruptTime.u.HighPart = KeInterruptTime.High1Time;
InterruptTime.QuadPart += CLOCK_TIME_INCREMENT;
InterruptTime.QuadPart += (CLOCK_TIME_INCREMENT * (1 + ExtraMs));
KeInterruptTime.High2Time = InterruptTime.u.HighPart;
KeInterruptTime.LowPart = InterruptTime.u.LowPart;
KeInterruptTime.High1Time = InterruptTime.u.HighPart;
@ -165,14 +165,14 @@ xbox::void_xt xbox::KiClockIsr()
// Update the system time
SystemTime.u.LowPart = KeSystemTime.LowPart;
SystemTime.u.HighPart = KeSystemTime.High1Time;
SystemTime.QuadPart += CLOCK_TIME_INCREMENT;
SystemTime.QuadPart += (CLOCK_TIME_INCREMENT * (1 + ExtraMs));
KeSystemTime.High2Time = SystemTime.u.HighPart;
KeSystemTime.LowPart = SystemTime.u.LowPart;
KeSystemTime.High1Time = SystemTime.u.HighPart;
// Update the tick counter
OldKeTickCount = KeTickCount;
++KeTickCount;
KeTickCount += (1 + static_cast<dword_xt>(ExtraMs));
// Because this function must be fast to continuously update the kernel clocks, if somebody else is currently
// holding the lock, we won't wait and instead skip the check of the timers for this cycle

View File

@ -66,7 +66,7 @@ namespace xbox
void_xt KiWaitListUnlock();
void_xt KiClockIsr();
void_xt KiClockIsr(ulonglong_xt ExtraMs);
xbox::void_xt NTAPI KiCheckTimerTable
(