Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Oct 2005 19:50:57 +0200
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        David Xu <davidxu@freebsd.org>, current@freebsd.org
Subject:   Re: Timers and timing, was: MySQL Performance 6.0rc1 
Message-ID:  <33946.1130521857@critter.freebsd.dk>
In-Reply-To: Your message of "Fri, 28 Oct 2005 18:33:19 BST." <20051028183034.U3405@fledge.watson.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20051028183034.U3405@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@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33946.1130521857>