Subject: Re: clock interrupt logic
To: <>
From: Frank Kardel <kardel@netbsd.org>
List: tech-kern
Date: 09/19/2006 19:47:45
Garrett D'Amore wrote:

>While looking at the stuff in tc_windup(), it occurs to that as this is
>called every clock interrupt (typically 100Hz), it would be really nice
>if we could shorten the "default" code path.
>  
>
I need to look at that again - it was already very carefully designed.
But I agree there is a big multiplication which could suck the life
out of an Intel 4004.

>For example, there is code in there to calculate changes resulting from
>adjtime.  I suspect (though I'm no NTP expert) that the adjtime call is
>only infrequently executed, and therefore recalculating the "th_scale"
>(which includes multiplication by a non-power-of-2 number, and division
>by the variable frequency), may be avoidable.  On some platforms these
>are really expensive operations.
>
>So maybe adjtime() or whatever could mark the scale as "dirty" and we
>only do this code if it is so marked?   Just a thought....
>  
>
Marking a time scale as dirty will most likely get you dirty time scale :-).

If the wrap around cycles are long enough the tc_tick value
could be increased so that tc_windup is only called every
tc_tick clock ticks to change counters and recalculate adjustments.
(see tc_ticktock())

You must insure though that tc_windup is called with at least
double to wrap around frequency of the active counter.

Maybe that will help you already.