Re: How to know HZ from userspace?

From: Albert D. Cahalan (acahalan@cs.uml.edu)
Date: Wed May 30 2001 - 22:23:05 EST


Jonathan Lundell writes:
> At 5:07 PM -0700 2001-05-30, H. Peter Anvin wrote:

>>> If you now want to set those values from a userspace program / script in
>>> a portable manner, you need to be able to find out of HZ of the currently
>>> running kernel.
>>
>> Yes, but that's because the interfaces are broken. The decision has
>> been that these values should be exported using the default HZ for the
>> architecture, and that it is the kernel's responsibility to scale them
>> when HZ != USER_HZ. I don't know if any work has been done in this
>> area.

Nope.

HZ-derived values are not scaled in the /proc code.
The real value is not available to apps. (Linus said so)
People often change the HZ value.

Thus we have problems.

Maybe I'll post my disgusting hack. You _can_ get HZ out
of /proc if you know where to look. >:-)

> FWIW (perhaps not much in this context), the POSIX way is
> sysconf(_SC_CLK_TCK) POSIX sysconf is pretty useful for this
> kind of thing (not just HZ, either).

That does not report the real value. It reports the default.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu May 31 2001 - 21:00:49 EST