>>>>> "Glen" == Glen Turner <g...@gdt.id.au> writes:

Glen> On Sun, 2010-05-23 at 17:02 +0800, tenz...@iinet.net.au wrote:
>> I'm seeking a preferably citeable reference to the amount of error
>> in the returned result from a Time() command. I want to be able to
>> quote the level of error in timing the execution speed of my
>> project.

Glen> "man time" gives the answer.

Actually it doesn't give the whole answer.  The times reported by the
kernel are statistical samples of the process's progress -- at each
tick, a sample is taken.  the currently process has either its user or
system time counter incremented, depending on whether it was running
in user or kernel at the time of the interrupt.

For processes that do a lot of short sleeps, this can be way out;
but processes that are mostly CPU-bound and that run for a long time
relative to the tick length can use the times reliably.

If you're on a platform that can do CONFIG_VIRT_CPU_ACCOUNTING
(Itanium, s390) you can rely on precise results at the cost of
about a 3% extra overhead on every context switch and kernel/userspace
crossing.

Alternatively, the microstate accounting patch can give you precise
times on Itanium, x86, x86_64, ARM and MIPS, although the latest
version isn't on the sourceforge website yet (it's on my TO-DO LIST)

Peter C
--
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