[ODE] Fw: timer.cpp portability (was Re: building on intel OSX)

Tanguy Fautre tanguy.fautre at spaceapplications.com
Fri Apr 7 04:32:04 MST 2006


gl wrote:
> Aren't there problems with using rdtsc raw?  IIRC you have to know or 
> measure the exact freq to get accurate time-elapsed results, it doesn't work 
> well on multi-processor systems, and can get confused by real-time clock 
> changes from power-saving setups.  That's why QueryPerformanceCounter is 
> usually recommended on x86.


Yes.

RDTSC should never be used to measure time. But only to measure the 
number of clock cycles (i.e. useful to measure code performance).

I did not say that the posted code is the answer to everything; just 
that it is a more portable implementation of rdtsc.


However, I just looked back at timer.cpp. And there is actually a 
portability/coherency problem:

- on Windows and Linux (non-x86), the timer measures the elapsed time

- on Linux x86 and x86-64, the timer measures the elapsed cpu cycles


AFAIK, timer.cpp is only used for (internally) benchmarking ODE. But 
nonetheless, a coherent behaviour should be chosen.


Tanguy


More information about the ODE mailing list