Messages in this thread | | | Date | Thu, 04 Jan 2001 18:44:08 -0500 | From | "Christopher Friesen" <> | Subject | Anyone else interested in a high-precision monotonic counter? |
| |
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.
Chris
-- Chris Friesen | MailStop: 043/33/F10 Nortel Networks | work: (613) 765-0557 3500 Carling Avenue | fax: (613) 765-2986 Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com - 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/
| |