From owner-freebsd-current@FreeBSD.ORG Fri Oct 28 17:51:00 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E19BF16A41F; Fri, 28 Oct 2005 17:51:00 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7595543D45; Fri, 28 Oct 2005 17:51:00 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.48.2]) by phk.freebsd.dk (Postfix) with ESMTP id A0059BC84; Fri, 28 Oct 2005 17:50:58 +0000 (UTC) To: Robert Watson From: "Poul-Henning Kamp" In-Reply-To: Your message of "Fri, 28 Oct 2005 18:33:19 BST." <20051028183034.U3405@fledge.watson.org> Date: Fri, 28 Oct 2005 19:50:57 +0200 Message-ID: <33946.1130521857@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: David Xu , current@freebsd.org Subject: Re: Timers and timing, was: MySQL Performance 6.0rc1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Oct 2005 17:51:01 -0000 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.