Re: Help with the high res timers

From: Chris Friesen
Date: Wed May 04 2005 - 13:21:59 EST


Nishanth Aravamudan wrote:

If I understand your point correctly, I think this is achieved by
TIMERINTERVAL_BITS in my patch (not to claim my patch is function, but
conceptually). No matter what you actually request, the best you can do
is 2^TIMERINTERVAL_BITS nanoseconds, and usually worse because the
tick-rate and timerinterval length do not necessarily line up.

My point is simply that the timer for the next interval should start at the time the timer expires, not the time that userspace picks up the prior expiration. Throttling the timer rate should be done at the time of timer request rather than timer expiry.

If I have usec-accuracy in the timer subsystem, I should be able to set a timer with an interval of 9.999ms and have it remain accurate over time (subject to scheduler jitter, of course). N timer intervals later my timer should expire at (original_time + N*9.999ms + jitter). In this case the error is roughly constant with time.

If the timer doesn't start counting the next interval until the user detects expiry, I'm going to get some non-zero addition to *each* interval such that my timers will not remain accurate over long periods of time. In this case N timer intervals later my timer will expire at (original_time + N*(9.999ms + jitter)) which is a very different thing. Since jitter will always be positive, the error increases with time.

Chris
-
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/