6 ms·
I'm pretty sure rdtsc is/was broken on Intel core 2 duos, especially those with power saving feature (like laptops).
by batbomb 12y ago
I'm pretty sure rdtsc is/was broken on Intel core 2 duos, especially those with power saving feature (like laptops).
- oso2k 12y agoNot broken, per se. Rdtsc counts instruction cycles. It's not an accurate indication of time when the clock rate is variable (and in fact pausible).
- batbomb 12y agoI believe it is actually not monotonic, which was a requirement for this library. That's why you end up using the high resolution timer which has a 10mhz clock rate instead. I ran into this problem trying to get better than 1us resolution for a daq system which was hooked up to custom GPS hardware which had better than 10ns resolution.
- Someone 12y agohttp://stackoverflow.com/a/19942784 http://stackoverflow.com/a/19942784: "So; to cut a long story short, if you want an accurate performance measurement you're mostly screwed. The best you can realistically hope for is an accurate time measurement; but only in some cases (e.g. when running on a single-CPU machine or "pinned" to a specific CPU; or when using RDTSCP on OSs that set it up properly as long as you detect and discard invalid values)."
- pbsd 12y agoCorrect. They only made rdtsc constant-rate with Nehalem and later chips, IIRC.
- rdtsc 12y agoThere is a flag on linux in /proc/cpuinfo that tells if it supports a constant rdtsc
- shin_lao 12y agoThe problem exists on AMD CPUs, not Intels. [...] for Intel Core Solo and Intel Core Duo processors [...]: the time-stamp counter increments at a constant rate. The specific processor configuration determines the behavior. Constant TSC behavior ensures that the duration of each clock tick is uniform and supports the use of the TSC as a wall clock timer even if the processor core changes frequency. This is the architectural behavior moving forward. Intel Architectures software developer system programming manual 17.13