Re: Anyone else interested in a high-precision monotonic counter?

From: Manfred Bartz (md-linux-kernel@logi.cc)
Date: Thu Jan 04 2001 - 22:29:00 EST


"Christopher Friesen" <cfriesen@nortelnetworks.com> writes:

> Has anyone ever considered including a microsecond-precision
> monotonically-increasing counter in the kernel? This would allow for
> easy timing of alarms and such by using absolute values of when the
> alarm should expire rather than a list of deltas from previous alarms.
>
> The thing I have in mind would store a value something like "xtime"
> (maybe call it "ytime"?) in the kernel. This value would be initialized
> to zero on startup, and would be incremented at the same time as
> "xtime". However, while "xtime" reflects adjustments to the actual
> system time (settimeofday(), date, ntp, etc.), this value would not.
> Finally, it would be accessed with a system call essentially identical
> to sys_gettimeofday(), only it would access "ytime" instead of "xtime"
> before going down and getting the microseconds from the RTC.
>
> This doesn't seem to me as though it would be all that tricky to add,
> and I could see it being very useful in providing a timing source that
> is guaranteed to
> a) be accurate to microseconds and
> b) never go backwards.

Why a new system call?

regarding a: it could have microsecond resolution but not
              microseconds accuracy.
regarding b: have you looked at the return-value of times(2)
              Or roll your own using setitimer(2)

-- 
Manfred
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 07 2001 - 21:00:20 EST