Date: Sun, 11 Feb 1996 21:04:46 +1100 From: Bruce Evans <bde@zeta.org.au> To: bde@zeta.org.au, phk@critter.tfs.com Cc: current@freebsd.org Subject: Re: calibrating clocks Message-ID: <199602111004.VAA04514@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>> I plan to calibrate all the system clocks relative to the MC14618A (RTC) >> clock and perhaps use the results automatically. Sample results on a >> P133 for a sequence of calibrations run at boot time: >Did you see the email about the "almost correct sub-tic" stunt ? >Basically you count how many times microtime was called per tick, >make a (short) running avg of it, and when people call microtime >you just return the tick + a counter times that avg. >For most if not all purposes this would be cheap and OK. Actually >only high-precision profiling and NTP would need any better... I don't think it's OK. It would be too inaccurate to use in mi_switch(), which seems to be the only place where its overhead is noticeable. One of the microtime() calls in mi_switch() could be avoided if the context switch is immediate. The i586 clock is good enough for the sub-tick count. Even if it varies, it can be rescaled often. The i8254 clock probably needs to be read on i586's every clock tick to determine the latency of hardclock(). The cost of this is < 5usec * 100 Hz = 500 usec/sec = 0.05%. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602111004.VAA04514>