0

Can c++ "chrono" library be used for real time measurements with Intel turbo boost processors which change the clock speed continuously?

Thanks

  • It gives you wall-time intervals (modulo changes to the system claock) because it uses a timesource that doesn't change with dynamic CPU frequency. On modern x86, that's the RDTSC counter, which runs at the fixed "reference clock" frequency (the rated "sticker" frequency of the CPU). On older x86 where RDTSC isn't invariant, and/or or where it stops when the CPU core clock is halted, the OS's `clock_gettime` can't use it as a time source. TL:DR: `std::chrono` is required to work correctly, so implementations can only use RDTSC when it's a valid time source. Usually the OS chooses. – Peter Cordes Jun 23 '18 at 13:03
  • Possible duplicate of [std::chrono::clock, hardware clock and cycle count](https://stackoverflow.com/questions/50883849/stdchronoclock-hardware-clock-and-cycle-count) – Peter Cordes Jun 23 '18 at 13:03

0 Answers0