Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to fix flaky Abseil waiter/sleep tests
The existing implementation uses wall-clock time. However, wall clock can drastically differ from the internal system clock, because the system can be suspended and then resumed. We want to account for at least some kinds of suspensions that might occur during automated testing, such as VM suspension or hypervisor preemption ("steal time"). These are tricky cases, because the physical (host) CPU is still running -- just the logical (guest) virtual CPU isn't. Therefore, we need to ensure that our time measurements exclude elapsed host-only time. Unfortunately the correctness of a method depends on the nature & configuration of each VM and the guest. For example, it can depend whether RDTSC is virtualized, or on whether the host and guest support accounting for steal time. Windows, for example, appears to only support steal time measurements if the hypervisor is Hyper-V. Since this is all for the sake of testing, we use a simpler trick that we hope will work around the problem on our systems: we subtract the so-called "interrupt time bias" from the system uptime in Windows. The interrupt time bias includes sleep/hibernation time, and seems to advance during for VM suspensions as well, so it may take care of the problem. PiperOrigin-RevId: 675654840 Change-Id: I66150b18912175fa72609d3f137e3ea4fee8fc43
- Loading branch information