Felipe Monteiro de Carvalho wrote:
I once implemented a high precision timer on linux, but I don't
remember how I did it. Look at the code here:

http://wiki.lazarus.freepascal.org/EpikTimer


Thanks, I'll have a look at the code for more details. From the wiki, it sounds like there might be some issues EpikTimer implementation though.

 * .... Timestamp Counter.
* Pentium IV 3,2Mhz on Windows and Linux with great precision (~ 3,220,000,000 ticks per second)


Timestamp counter from the CPU (assuming we are speaking of RDTSC) is susceptible to many issue. eg: A Intel P4 3.2Mhz does not always produce 3,220,000,000 ticks per second. Powersaving features like SpeedStep, Hibernate etc all affect the CPU clock speed. Also on a multi-core system, not all cores are guaranteed to run at the same clock speed.

Above information was gathered from the WikiPedia article.
  http://en.wikipedia.org/wiki/Rdtsc

Anybody know what Win32's QueryPerformanceCounter() uses internally to get a stable timer? Or is QueryPerformanceCounter also susceptible to powersaving features?


Regards,
  - Graeme -


_______________________________________________________
fpGUI - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to