Re: high-res-timers start code.

Robert H. de Vries (rhdv@rhdv.cistron.nl)
Mon, 23 Apr 2001 23:25:32 +0200


On Monday 23 April 2001 22:43, George Anzinger wrote:
> "Robert H. de Vries" wrote:
> > On Monday 23 April 2001 19:45, you wrote:
> > > By the way, is the user land stuff the same for all "arch"s?
> >
> > Not if you plan to handle the CPU cycle counter in user space. That is at
> > least what I would propose.
>
> Just got interesting, lets let the world look in.
>
> What did you have in mind here? I suspect that on some archs the cycle
> counter is not available to user code. I know that on parisc it is
> optionally available (kernel can set a bit to make it available), but by
> it self it is only good for intervals. You need to peg some value to a
> CLOCK to use it to get timeofday, for instance.
>
> On the other hand, if there is an area of memory that both users and
> system can read but only system can write, one might put the soft clock
> there. This would allow gettimeofday (with the cycle counter) to work
> without a system call. To the best of my knowledge the system does not
> have such an area as yet.

It obviously is an architecture dependent thing. I know of two archtictures
which have such a counter: your standard pentium and up and the SGI systems
from at least the Indy and up. I wouldn't be surprised if most CPU's have
such a counter. If you look at some of the architecture specific code for the
gettimeofday code you would quickly find out which architectures have such a
feature. I have some code for the intel in my user space library. For the SGI
I also have some code, but only for IRIX. I guess for Linux we could do
similar code.

Robert

-- 
Robert de Vries
rhdv@rhdv.cistron.nl
-
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/