Just a sanity check before I sumbit a buig report
jilles at stack.nl
Sun Mar 13 08:25:35 PST 2005
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
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().
More information about the freebsd-stable