[ntp:questions] Re: Why not use timeEndPeriod?

Martin Burnicki martin.burnicki at meinberg.de
Thu Aug 31 10:27:58 UTC 2006


YOYO wrote:
> Hi,
> i found a strange question. when i use my ntpdate to
> synchronize time in my network(*), the cpu usage rises
> to a high level, and when i stop ntpdate, cpu reaches a
> proper value.
> so, i found the following code in ntpdate.c, the point is
> when we called "timeBeginPeriod" to adjust the timer,
> we should call the pare function "timeEndPeriod".
> without doing this, the cpu usage for each process
> might  rise a little bit, and the total cpu usage might
> rises a higher level(normally 30% higher).
> is that something wrong with the function call?
> thanks for any hints or thoughts.

You're right, timeEndPeriod should be called when an application shuts down
which has called timeBeginPeriod at startup.

For ntpd I've submitted a patch which calls these functions properly to set
the Windows multimedia timer optionally to highest resolution while ntpd is
active. This is in order to avoid time steps which are introduced if
another application which uses the MM timer is started or stopped.

However, in case of ntpdate using the MM timer does not make sense anyway,
IMHO, so we should remove the timeBeginPeriod call, or add the missing
timeEndPeriod call. Some cleanup is required, anyway. If you agree I'll
open a bugzilla issue on this.

Martin Burnicki

Meinberg Funkuhren
Bad Pyrmont

More information about the questions mailing list