perf-book icon indicating copy to clipboard operation
perf-book copied to clipboard

The clock_gettime execution time is not 500ns

Open ujos opened this issue 1 year ago • 1 comments

In the book page 34 there is a sentence:

Making a clock_gettime system call can be much slower than executing RDTSC The latter takes about 5ns while the former takes about 500ns.

high_resolution_clock is not that expensive:

  • On my laptop with 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz CPU and Ubuntu 22.04 it takes 12ns.
  • On the AMD EPYC 9274F 24-Core CPU RH9 it takes 20ns
  • On the Intel(R) Xeon(R) Gold 5318Y CPU RH9 it takes 23ns

ujos avatar Jan 01 '25 20:01 ujos