4 ms·
As a minor but relevant nit, it's very strange that the C code you're quoting uses int64_t as the type for the timestamp. The Intel code in the linked paper do
by unwind 5y ago
As a minor but relevant nit, it's very strange that the C code you're quoting uses int64_t as the type for the timestamp.
The Intel code in the linked paper does not, it uses uint64_t but that was somehow changed when the code was transcribed. Also the clobbers mentioned in the paper are missing, which is suspicious.
The paper has a lot of analysis and includes better implementations, using cpuid and/or the rdtscp instruction.