>>>>> "tenzero" == tenzero  <tenz...@iinet.net.au> writes:

tenzero> Hi everyone, I'm seeking a preferably citeable reference to
tenzero> the amount of error in the returned result from a Time()
tenzero> command. I want to be able to quote the level of error in
tenzero> timing the execution speed of my project.



Do you mean time(2) ???

Short answer:  it depends.
Long answer: time(2) returns the number of seconds since the epoch.
It's accurate for timing in the absence of leap-seconds, and jumps
caused by NTP etc.  But it can go backwards, and forwards by more than
one step at a time.

For details, see time(7).


If you want accurate timings, use one of the POSIX monotonic clocks.
man 3 clock_gettime and look for CLOCK_MONOTONIC

Also, you are aware (I assume) that how long something takes depends
not only on its own processing time, but on how much else is happening
on the system?  You can measure just your own process (and its
children's) times using the times() system call; if the kernel has
been compiled with CONFIG_VIRT_CPU_ACOUNTING time spent in interrupts
will not be included in your times.  This isn't such an issue on
BSD-derived systems such as MacOSX, because they use separately
scheduled threads for interrupts.
--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to