Saturday, September 19, 2015

RDTSCP vs. CPUID+RDTSC

Hello all,

Do you have any thoughts on RDTSCP vs. CPUID+RDTSC for timing? I don't believe we are allowed to use RDTSCP on the lab machines as it's a privileged instruction. Long story short, the "P" version of the instruction serializes the CPU pipeline before getting the cycle counter, to more fine-tune the results of your measurement. However, CPUID also flushes the pipeline, so would simply putting it before an RDTSC yield similar results?

Curious if people are doing this or simply using RDTSC (as our numbers are varying a bit from other people's).


I've also authored a StackOverflow question in the past (some of my past research has involved these types of benchmarks, but at the kernel level) which you may have run into: http://stackoverflow.com/questions/27693145/rdtscp-versus-rdtsc-cpuid and got a relatively similar answer to my thoughts.

1 comment: