Take the 2-minute tour ×  I know that I have to use: rdtsc. The
measured function is deterministic but the result is far from
being repeatable (I get 5% oscillations from run to run).
Possible causes are:    • context switching   • cache misses  Do
you know any other causes? How to eliminate them?  share|improve
this question add comment  6 Answers  up vote 3 down vote
accepted  TSCs (what rdtsc uses) are often not synchronized on
multi-processor systems. It may help to set the CPU affinity in
order to bind the process to a single CPU.  You could also get
timestamps from HPET timers if available, which aren't prone to
the same problem.  As for repeatability, those variances are
true. You could disable caching, give a realtime priority to the
process and/or (if on Linux or something similar) recompile your
kernel with a lower, fixed timer interrupt frequency (the one
that does time-slicing). You can't eliminate the variance
completely, at least not easily and not on regular CPU + OS
combos.  In general, for ea