On a cpu with constant_tsc and nonstop_tsc, why does my time drift?
问题 I am running this test on a cpu with constant_tsc and nonstop_tsc $ grep -m 1 ^flags /proc/cpuinfo | sed 's/ /\n/g' | egrep "constant_tsc|nonstop_tsc" constant_tsc nonstop_tsc Step 1: Calculate the tick rate of the tsc: I calculate _ticks_per_ns as the median over a number of observations. I use rdtscp to ensure in-order execution. static const int trials = 13; std::array<double, trials> rates; for (int i = 0; i < trials; ++i) { timespec beg_ts, end_ts; uint64_t beg_tsc, end_tsc; clock