From owner-cvs-all@FreeBSD.ORG Sat May 10 11:21:51 2008 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B6461065674; Sat, 10 May 2008 11:21:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail18.syd.optusnet.com.au (mail18.syd.optusnet.com.au [211.29.132.199]) by mx1.freebsd.org (Postfix) with ESMTP id 74D4E8FC0A; Sat, 10 May 2008 11:21:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c220-239-252-11.carlnfd3.nsw.optusnet.com.au [220.239.252.11]) by mail18.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m4ABLfhM021375 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 May 2008 21:21:42 +1000 Date: Sat, 10 May 2008 21:21:41 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alfred Perlstein In-Reply-To: <20080510012645.GV32532@elvis.mu.org> Message-ID: <20080510210124.H2970@besplex.bde.org> References: <200805090742.m497g3qL054749@repoman.freebsd.org> <200805090908.m4998KvB007397@haluter.fromme.com> <20080510012645.GV32532@elvis.mu.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Pawel Jakub Dawidek , src-committers@freebsd.org, Oliver Fromme , cvs-all@freebsd.org, cvs-src@freebsd.org Subject: Re: cvs commit: src/sys/kern subr_param.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 May 2008 11:21:51 -0000 On Fri, 9 May 2008, Alfred Perlstein wrote: > * Oliver Fromme [080509 02:08] wrote: >> >> Pawel Jakub Dawidek wrote: >> > Modified files: >> > sys/kern subr_param.c >> > Log: >> > - Export HZ value via kern.hz sysctl (this is the same name as for the >> > loader tunable). >> >> It's probably just me, but I don't see the usefulness of >> this. The HZ value is already exported via kern.clockrate. >> (I'm not saying the change is wrong, I'm just looking for >> an explanation.) >> >> (On the other hand, how about exporting the value of the >> kernel variable "ticks"? Just a thought.) > > I've exported 'ticks' before for local hacks, it was useful, making it exported > in FreeBSD would be a good idea. Why all this bloat? A ticks counter is already exported as a sysctl in kern.cp_time (add up all the times to get a total. Most statistics utilities do this). Before FreeBSD-4, and still on systems with no separate statclock or with stathz == hz like some of mine, this gives almost exactly the same count as the kernel `ticks' variable. It's hard to think of an application where knowing the variable would be better than this in cases where they are different. Schedulers in the kernel don't use the variable. The variable might be more accurate due to HZ being excessively large, but if you want accuracy, not to mention speed, use clock_gettime(2). I can never remember which sysctls give frequencies and often type "sysctl -a | grep freq". The one for hz is harder to find since it spells "frequency" weirdly as "clockrate" in its name and as "hz" in its output, so it doesn't show up in the above grep. Bruce