Re: Timers and timing, was: MySQL Performance 6.0rc1

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Fri, 28 Oct 2005 19:50:57 +0200
In message <20051028183034.U3405_at_fledge.watson.org>, Robert Watson writes:

>If we remove the call to nanotime() in the context switch, we may want to 
>add a callout that calls nanotime() once each tick?  Or maybe 
>automatically in the callout handler, so that any code running in a 
>callout can use getnanotime() without having to worry about accuracy 
>(much).

The timecounters already update the once every N hardclock ticks (search
for "tc_ticktock" and this happens before callouts are called.

The reason for the N divisor is to not needlessly burn CPU cycles on
systems with very high HZ.

For Hz up to and in cluding 1000, N=1 so every tick updates the timestamps
which get{bin,nano,micro}time() copies.

For Hz higher than 1000, N is set to attempt to update the timestamps
once per millisecond:

	tc_tick = (hz + 500) / 1000;

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
Received on Fri Oct 28 2005 - 15:51:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:46 UTC