Messages in this thread | | | Date | Wed, 17 May 2006 11:23:35 +1000 | From | Peter Chubb <> | Subject | Re: [RFC] [Patch 7/8] statistics infrastructure - exploitation prerequisite |
| |
Anrd> Am Wednesday 17 May 2006 00:36 schrieb Martin Peschke: > Any other hints on how to replace my sched_clock() calls are welcome. > (I want to measure elapsed times in units that are understandable to > users without hardware manuals and calculator, such as milliseconds.)
Anrd> There are a number of APIs that allow you to get the time:
Anrd> - do_gettimeofday Anrd> potentially slow, reliable TOD clock, microsecond resolution
Slow, not necessarily safe to call in IRQ context.
Anrd> - ktime_get_ts Anrd> monotonic clock, nanosecond resolution
Actual resolution varies by platform, it may be as low as jiffy.
Anrd> - getnstimeofday Anrd> reliable, nanosecond TOD clock
(which is only currently implemented with ns resolution on IA64 and Sparc64, AFAIK)
Anrd> - xtime Anrd> jiffie accurate TOD clock, with fast reads
Too coarse a resolution.
Anrd> - get_cycles Anrd> highest supported resolution and accuracy, highly Anrd> HW-specific behaviour, may overflow.
Not very usable on SMP if you want to measure across migration; may be variable rate.
-- 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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |