time measurement

Matthew Dillon dillon at apollo.backplane.com
Mon May 2 16:14:55 PDT 2005


:To what degree of precision can we measure the clock as end-user
:programmers. I have found the functions nanotime and microtime but they are
:restricted to kernel development only. I know realtime linux has a
:microtime function availible for the user base. Is there an api or non
:kludgy method for doing some time measurements in the order of microseconds
:or even nanoseconds??
:
:  John

    gettimeofday(&tv, NULL) will return the time with microseconds 
    granularity.

    If you are doing any sort of time differential measurements it's
    usually a good idea to time as long a run as possible, to reduce
    error.  Take a look at the stuff in /usr/src/test/sysperf for an
    example.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Users mailing list