Re: 2.6.14-rt13
From: Vojtech Pavlik
Date: Sat Nov 19 2005 - 02:46:40 EST
On Fri, Nov 18, 2005 at 06:28:24PM -0800, George Anzinger wrote:
> >There are many mechanisms to keep time:
> >
> >1) RTC: 0.5 sec resolution, interrupts
> >2) PIT: takes ages to read, overflows at each timer interrupt
> >3) PMTMR: takes ages to read, overflows in approx 4 seconds, no interrupt
>
> The PMTMR can be read from user space (if you can find it). See the
> "iopl" man page. It is an I/O access and so is slow, but you can read
> it.
Yes, however this must be limited to a small number of privileged
applications - iopl() is only available to CAP_SYS_RAWIO IIRC,
and thus it's not suitable for general use.
> Finding it is another matter. It does not have a fixed address (i.e.
> it differs from machine to machine, but is constant on any given
> machine). The boot code roots it out of an info block put in memory
> by the BIOS. I suppose one could put a printk in the boot code to
> disclose it...
There is really no reason to do that, since the time to read it (~1200
ns) is much less than the time to enter the kernel (less than 200 ns),
so gettimeofday() is definitely easier to use and also doesn't overflow.
--
Vojtech Pavlik
SuSE Labs, SuSE CR
-
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/