morganstanley/binlog

How to use rdtsc to get time

Closed this issue · 1 comments

It's described in the README.md that rdtsc is the fastest way to get time under linux.

Benchmark Std. Dev. Median
One integer (no clock) 0 ns 8 ns
One integer (TSC clock) 0 ns 9 ns
One integer (sys clock) 0 ns 34 ns
One integer (poison cache) 8 ns 740 ns
One string 0 ns 38 ns
Three floats 0 ns 30 ns

But in the soruce code I saw clockNow uses clock_gettime. Is there a way or special version that uses rdtsc to get time under linux?

Thanks.