|Title||Event clock implementation may not be reliable|
|Assigned user||Gareth Rees|
|Description||The event clock implementation reads the Time Stamp Counter via the RDTSC instruction. But this may not be reliable.|
Wikipedia says : "With the advent of multi-core/hyper-threaded CPUs, systems with multiple CPUs, and hibernating operating systems, the TSC cannot be relied on to provide accurate results. ... There is no promise that the timestamp counters of multiple CPUs on a single motherboard will be synchronized. In such cases, programmers can only get reliable results by locking their code to a single CPU."
Windows documentation says : "We strongly discourage using the RDTSC or RDTSCP processor instruction to directly query the TSC because you won't get reliable results on some versions of Windows, across live migrations of virtual machines, and on hardware systems without invariant or tightly synchronized TSCs."
|Analysis||It looks as if QueryPerformanceCounter  may be the right API on Windows, and clock_gettime(CLOCK_MONOTONIC)  on POSIX. But are these fast enough? If they use system calls then there are not so good.|
See "Pitfalls of TSC usage" , which discusses the situation on Linux.
|Created by||Gareth Rees|
|Created on||2016-03-06 21:51:32|
|Last modified by||Gareth Rees|
|Last modified on||2016-09-18 20:35:57|
|History||2016-03-06 GDR Created.|