Comments: stop calling a CPU tick a microsecond

Both comments predate GetCPUTicks() reading CNTVCT_EL0 and give a tick
scale this host does not have; one of them leaves a plain tick count
looking like a duration. The code under them already divides by
GetTickFrequency(), and is unchanged.
This commit is contained in:
pstef
2026-08-09 11:20:53 +02:00
parent 2e39fcc216
commit 5b2713c220
2 changed files with 6 additions and 5 deletions
+4 -4
View File
@@ -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();
+2 -1
View File
@@ -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<s32>((sDeltaTime * -1000) / static_cast<s64>(GetTickFrequency()));
// If any integer value of milliseconds exists, sleep it off.