Re: finding out the value of HZ from userspace

From: Bernd Petrovitsch
Date: Tue Mar 16 2004 - 04:23:39 EST


On Die, 2004-03-16 at 06:53, Peter Williams wrote:
> Andi Kleen wrote:
> > Peter Williams <peterw@xxxxxxxxxx> writes:
[...]
> > Already exists for a long time - AT_CLKTCK. glibc has a nice wrapper
> > for it too (sysconf)
>
> So it does and POSIX.1 (_SC_CLK_TCK) compliant as well. Unfortunately,
> the presence of this functionality makes it VERY difficult to understand
> why ticks are being converted from HZ==1000 values to HZ=100 values when
> they are being exported to user space especially as this conversion
> throws away precision. Can anyone enlighten me?

1) Because Linux had long time HZ=100 hardcoded (except on Alphas) and
lots of applications probably use that value today (as HZ in their
source and not sysconf(...)) - especially since 2.4 (at least most
of them) has HZ=100 except for 64bit CPUs).
2) There are patches which dynamically change the CPU speed. And it
probably (IMHO) makes sense to change HZ dynamically too in that
situations. And a over-time changing HZ value is useless in
user-space.

Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/