Suppose all the cores in my CPU have same frequency, technically I can synchronize system time and time stamp counter pairs for each core every millisecond or so. Then based
Don't do that -using yourself directly the RDTSC machine instruction- (because your OS scheduler could reschedule other threads or processes at arbitrary moments, or slow down the clock). Use a function provided by your library or OS.
My main objective is to avoid the need to perform system call every time I want to know the system time
On Linux, read time(7) then use clock_gettime(2) which is really quick (and does not involve any slow system call) thanks to vdso(7).
On a C++11 compliant implementation, simply use the standard vdso
)
Last time I measured clock_gettime
it often took less than 4 nanoseconds per call.