diff --git a/common/HostSys.cpp b/common/HostSys.cpp index bae6ad1c45..31be63089e 100644 --- a/common/HostSys.cpp +++ b/common/HostSys.cpp @@ -52,10 +52,10 @@ static void MultiPause() static u32 MeasurePauseTime() { - // GetCPUTicks may have resolution as low as 1µs - // One call to MultiPause could take anywhere from 20ns (fast Haswell) to 400ns (slow Skylake) - // We want a measurement of reasonable resolution, but don't want to take too long - // So start at a fairly small number and increase it if it's too fast + // A tick isn't a fixed time unit (see GetCPUTicks()), so this loop works in raw + // ticks and only converts to ns once it has enough. One MultiPause takes 20ns on + // a fast Haswell, 400ns on a slow Skylake, 83ns for the eight isb on a Cortex-A78C. + // Start small and double the batch until the tick delta clears 100. for (int testcnt = 64; true; testcnt *= 2) { u64 start = GetCPUTicks(); diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index 240e69368e..5fd4441af7 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -2480,7 +2480,8 @@ void VMManager::Internal::Throttle() return; } - // Conversion of delta from CPU ticks (microseconds) to milliseconds + // Conversion of delta from CPU ticks to milliseconds; a tick's time value is + // host-defined, so this has to divide by GetTickFrequency() rather than scale by a constant. const s32 msec = static_cast((sDeltaTime * -1000) / static_cast(GetTickFrequency())); // If any integer value of milliseconds exists, sleep it off.