lkml.org 
[lkml]   [2001]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Anyone else interested in a high-precision monotonic counter?
Date
"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/

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.054 / U:3.860 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site