On Tue, 13 Sep 2005, Mark Hounschell wrote:
I need to know the kernels value of HZ in a userland app.
getconf CLK_TCK
and
hz = sysconf (_SC_CLK_TCK)
both seem to return CLOCKS_PER_SEC which is defined as USER_HZ which is
defined as 100.
include/asm/param.h:
#ifdef __KERNEL__
# define HZ 1000 /* Internal kernel timer frequency */
# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
#endif
Thanks in advance for any help
Mark
You are not supposed to 'tear apart' user-mode headers. In particular
you are not supposed to use anything in /usr/include/bits, /usr/include/asm,
or /usr/include/linux in user-mode programs. These are not POSIX headers.
Therefore, HZ is not something that is defined for user-mode programs.
the ANSI spec requires that things like clock() return a value that
can be divided by CLOCKS_PER_SEC to get CPU time. Nothing in user-mode
uses HZ. That's the reason why later versions of the kernel are
able to use dynamic HZ.