Re: [RFC] [Patch 7/8] statistics infrastructure - exploitation prerequisite
From: Peter Chubb
Date: Tue May 16 2006 - 21:24:16 EST
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
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
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/