[ntp:questions] micro-optimization

Dave Hart davehart at gmail.com
Wed Mar 11 04:00:17 UTC 2009

On Mar 11, 2:01 am, Augustine <evan... at mailinator.com> wrote:
> On Mar 10, 11:13 am, Dave Hart <daveh... at gmail.com> wrote:
> > Since my last
> > release, the most significant change is to read the processor cycle
> > counter using the RDTSC instruction directly when it is equivalent to
> > QueryPerformanceCounter.
> Just keep in mind that Windows' power management will change the
> frequency of a processor, thereby making the count returned by RDTSC
> have a variable rate on some processors (namely Intel's Pentium4 and
> AMD's Athlon and Opteron).

I suspect those systems' HALs don't use RDTSC for
QueryPerformanceCounter, so RDTSC won't be used.  Only if they're
found to be beating at the same rate (possibly with an offset) does
RDTSC get substituted.

Dave Hart

More information about the questions mailing list