Is it possible to use the clflush instruction/function in i3/i7 processors to the flush the cache and check if the cache is empty or not?? If so - please suggest a correct f
rdtsc
isn't a serializing instruction, as such the measurement is not accurate. As a quick hack you can insert a cpuid
call, taking care to update the clobber list too:
asm volatile ("cpuid; rdtsc" : "=a" (a), "=d" (d) : : "ebx", "ecx");
At least for me, that changed the output to match expectations.