[ILUG] Measuring time

Paul Kelly longword at esatclear.ie
Thu May 24 20:08:15 IST 2001


Anthony Harrington wrote:

> Can anyone tell me a system call for measuring time in nano-seconds ?


I don't believe there is one. The overhead of a syscall will affect your 
timing anyway. Your best bet is probably the TSC - a CPU register on 
i586 class CPUs. It's a counter increments every clock cycle, so the 
resolution - and the answer you get from it - depends on the clock speed 
of the CPU. Have a look in the source of UAE for an example of how to 
use it.

Not what you'd call portable, but it gets the job done.

Paul.





More information about the ILUG mailing list