MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / MeasurePauseTime

Function MeasurePauseTime

common/HostSys.cpp:48–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48static u32 MeasurePauseTime()
49{
50 // GetCPUTicks may have resolution as low as 1µs
51 // One call to MultiPause could take anywhere from 20ns (fast Haswell) to 400ns (slow Skylake)
52 // We want a measurement of reasonable resolution, but don't want to take too long
53 // So start at a fairly small number and increase it if it's too fast
54 for (int testcnt = 64; true; testcnt *= 2)
55 {
56 u64 start = GetCPUTicks();
57 for (int i = 0; i < testcnt; i++)
58 {
59 MultiPause();
60 }
61 u64 time = GetCPUTicks() - start;
62 if (time > 100)
63 {
64 u64 nanos = (time * 1000000000) / GetTickFrequency();
65 return (nanos / testcnt) + 1;
66 }
67 }
68}
69
70__noinline static void UpdatePauseTime()
71{

Callers 1

UpdatePauseTimeFunction · 0.85

Calls 3

MultiPauseFunction · 0.85
GetCPUTicksFunction · 0.50
GetTickFrequencyFunction · 0.50

Tested by

no test coverage detected