Date: Sat, 10 May 2008 21:21:41 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Alfred Perlstein <alfred@freebsd.org> Cc: Pawel Jakub Dawidek <pjd@freebsd.org>, src-committers@freebsd.org, Oliver Fromme <olli@fromme.com>, cvs-all@freebsd.org, cvs-src@freebsd.org Subject: Re: cvs commit: src/sys/kern subr_param.c Message-ID: <20080510210124.H2970@besplex.bde.org> In-Reply-To: <20080510012645.GV32532@elvis.mu.org> References: <200805090742.m497g3qL054749@repoman.freebsd.org> <200805090908.m4998KvB007397@haluter.fromme.com> <20080510012645.GV32532@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 9 May 2008, Alfred Perlstein wrote: > * Oliver Fromme <olli@fromme.com> [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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080510210124.H2970>