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.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!