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 format of usage (in C directly or inline assembly in C)
I was told that clflush does work properly beyond core 2 duo processors. I am stating this question after having been redirected from this link (below) ------->
¨Is there a way to check whether the processor cache has been flushed recently?¨
my results are not matching as expected. This is what I am getting these results:
took 83 ticks
took 66 ticks
flush: took 52 ticks
took 45 ticks
-------------------> how can the cpu take less ticks after having flushed the cache? (refer to line 2 and 3 of the results that i have gotten)
rdtsc
isn't a serializing instruction, as such the measurement is not accurate. As a quick hack you can insert acpuid
call, taking care to update the clobber list too:At least for me, that changed the output to match expectations.