Hi,
On Fri, 19 Aug 2005, john stultz wrote:
> timekeeping_perioidic_hook():
>
> /* get ntp adjusted interval length*/
> interval_length = get_timesource_interval(ppm)
Here starts the problem, this requires more expensive math than necessary,
as every time you first have to scale the values.
Let's take a standard PIT timer as an example. With HZ=100 we program it
with 11932, for simplicity let's assume this corresponds to 10^7ns and
scale this by 2^8. This means the timer multiplier is initially 214549,
this updates the system time by 214549*11932 and the reference time by
10^7*2^8 every tick. We can now just ignore the error or as soon as it
exceeds 11932/2 we increase/decrease the mutiplier. The error calculation
is rather simple, usually just adds and shifts, only if the error exceeds
2*11932 it gets a little more complicated, but even here the possible
divide is avoidable.
The gettimeofday would then basically be "xtime + (cycle_offset * mult +
error_offset) / 2^8". Depending on the update frequency and the required
precision it's even possible to keep this within 32bit. The ntp part stays
pretty much the same and the time source can add anything it wants on top
of that. The basic math is also pretty much the same so we can generate
most of the code depending on various parameters.
bye, Roman
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|