| 46 | } |
| 47 | |
| 48 | static 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 | { |
no test coverage detected