getconf CLK_TCK and CONFIG_HZ

Jim Cromie jim.cromie at gmail.com
Sat Mar 12 17:37:12 EST 2011


Im trying to do a little benchmarking of perl, and have patched its distro
files
to run perl's times() function on each of the ~1900 test files.
perl's times() uses man 2 times internally, which I presume reduces to a
system-call

The standard distro can be run as: HARNESS_TIMER=1 make test
but this counts only wall-clock time, and is thus sensitive to system load.
times does better,

Anyway, the 1st thing I noticed on the times numbers was that they all have
10ms granularity.

This agrees with sysconf granularity :
$ getconf CLK_TCK
100

but not with linux kernel HZ:
$ grep _HZ /boot/config-`uname -r`
CONFIG_RCU_FAST_NO_HZ=y
CONFIG_NO_HZ=y
# CONFIG_HZ_100 is not set
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
CONFIG_HZ_1000=y
CONFIG_HZ=1000

Confusingly, man 2 times says :
NOTES
       The number of clock ticks per second can be obtained using:

           sysconf(_SC_CLK_TCK);

       In POSIX.1-1996 the symbol CLK_TCK (defined in <time.h>)  is
 mentioned
       as obsolescent.  It is obsolete now.

but linux (fedora 13) seems to disagree :

$ getconf _SC_CLK_TCK
getconf: Unrecognized variable `_SC_CLK_TCK'


So, the Questions:

Why arent they the same ? or what am I missing wrt
the relationship between sysconf(CLK_TCK) and kernel HZ ?

Is it possible to coax the kernel into counting times in 1ms via some
cmd-line option ?
I searched Documentation/kernel-parameters.txt, found nothing.

is it possible to compile kernel with different HZ options to get the 1ms
resolution ?

Why doesnt times() also count IO-wait states for a process (and children) ?
I note that top reports it (as a system-wide measure)
and System Monitor 2.30.0 displays it (same system-wide measure)

hypothetically, if IO-wait numbers were collected by times
(API/ABI change, so never gonna happen) would it be able to reveal anything
?
Id expect it to show measure disk activity due to the process, and arguably
be
sensitive to system load, unlike user, sys, child-user, child-sys numbers
but it still sounds useful.

Could process specific IO-wait numbers reveal anything about cache
performance ?

Do cache misses contribute to IO-wait, or do they get counted in other ways
?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110312/11d6c228/attachment.html 


More information about the Kernelnewbies mailing list