Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Mar 2005 17:25:33 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Jon Noack <noackjr@alumni.rice.edu>
Cc:        Pete French <petefrench@ticketswitch.com>
Subject:   Re: Just a sanity check before I sumbit a buig report
Message-ID:  <20050313162533.GA14952@stack.nl>
In-Reply-To: <4231FC02.8050205@alumni.rice.edu>
References:  <E1D9mka-000P9Q-1Y@dilbert.firstcallgroup.co.uk> <4231FC02.8050205@alumni.rice.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 11, 2005 at 02:13:54PM -0600, Jon Noack wrote:
> Pete French wrote:
> >>Why does sysconf(_SC_CLK_TCK) always returns 128?  Check out sysconf() 
> >>in src/lib/libc/gen/sysconf.c (lines 83-84 of rev. 1.10):

> >[follow through of code showing it is defined as a constant snipped]

> sysconf(3) states that _SC_CLK_TCK is the "frequency of the statistics 
> clock in ticks per second."  Considering this value varies, returning a 
> constant is wrong.  Feel free to attach my email on the PR.

An important use for sysconf(_SC_CLK_TCK) is to specify the rate of the
results of times(3). (I don't know how many applications call that
stupid function, getrusage() having been available for so long ;-)
Currently, src/lib/libc/gen/times.c compiles this in just like sysconf.c
does. So that's all ok; times.c will have to be modified too if
sysconf(_SC_CLK_TCK) changes. 

getrusage(2) says that ru_ixrss is based on "statistics clock ticks"
with a frequency of sysconf(_SC_CLK_TCK). This cannot be right.
In other systems, getrusage often only really supports the timeval
fields and perhaps the fault and swap counts; if it is supported, the
ru_i?rss ticks are often not described at all or they are something
strange like one per second. Consequently, this facility is nonportable
and the tick frequency should be described using sysctl().

-- 
Jilles Tjoelker



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