On 01/16/07 10:06, Frank Hofmann wrote:

With your original "ftime" code, the clock resolution could falsify your results. With "gethrtime", zero time taken means a bug on the OS where that is reported. Two consecutive gethrtime() calls, even with nothing in-between, may not report the same values.

That is not true - gethrtime is monotonic not strictly monotonic.
From the Solaris manpage:

NOTES
     Although the units  of  hi-res  time  are  always  the  same
     (nanoseconds),  the actual resolution is hardware dependent.
     Hi-res time is guaranteed to be monotonic (it won't go back-
     ward, it won't periodically wrap) and linear (it won't occa-
     sionally speed up or slow down for adjustment, like the time
     of  day  can),  but not necessarily unique: two sufficiently
     proximate calls may return the same value.

On sparc systems with a 12.5MHz STICK clock it is quite feasible
to obtain two identical STICK values (and hence gethrtime values)
with much higher cpu clock frequencies.

Gavin
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to