From owner-freebsd-stable@FreeBSD.ORG Fri Dec 2 19:02:48 2005 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1E44616A41F for ; Fri, 2 Dec 2005 19:02:48 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5609C43D58 for ; Fri, 2 Dec 2005 19:02:47 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c220-239-19-236.belrs4.nsw.optusnet.com.au [220.239.19.236]) by mail06.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id jB2J2hv4003331 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sat, 3 Dec 2005 06:02:44 +1100 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1]) by cirb503493.alcatel.com.au (8.12.10/8.12.10) with ESMTP id jB2J2hHh041151; Sat, 3 Dec 2005 06:02:43 +1100 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost) by cirb503493.alcatel.com.au (8.12.10/8.12.9/Submit) id jB2J2hjE041150; Sat, 3 Dec 2005 06:02:43 +1100 (EST) (envelope-from pjeremy) Date: Sat, 3 Dec 2005 06:02:43 +1100 From: Peter Jeremy To: kama Message-ID: <20051202190242.GL32006@cirb503493.alcatel.com.au> References: <20051202142731.H92866@ns1.as.pvp.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051202142731.H92866@ns1.as.pvp.se> User-Agent: Mutt/1.4.2.1i X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc Cc: freebsd-stable@freebsd.org Subject: Re: cpu-timer rate X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2005 19:02:48 -0000 On Fri, 2005-Dec-02 14:32:58 +0100, kama wrote: >I am just wondering why the cpu-timer is doubled from what I set in >kern.hz? > ># vmstat -i >interrupt total rate ... >cpu0: timer 14314031 1999 >Total 14750922 2060 > ># sysctl -a | grep hz >kern.clockrate: { hz = 1000, tick = 1000, profhz = 666, stathz = 133 } There's only a single timer but FreeBSD needs two independent clocks. The 'tick' clock is used to update the TOD counters and decide when to reschedule processes. The 'stathz' is used to collect statistics on CPU utilisation ('profhz' is used instead if any process is using profiling). Since processes tend to synchronize to 'tick' the statistics clock needs to be independent to ensure that a CPU utilisation is correctly allocated. In order to simulate two clocks, FreeBSD runs the hardware clock at a high rate and uses two different divisors for the soft clocks (/2 for tick, /3 for profhz and /15 for stathz). Larger divisors are better for utilisation statistics but increase clock interrupt overheads. -- Peter Jeremy