Re: How to know HZ from userspace?

From: Harald Welte (laforge@gnumonks.org)
Date: Thu May 31 2001 - 10:52:25 EST


On Wed, May 30, 2001 at 11:40:30PM -0400, Albert D. Cahalan wrote:
> Harald Welte writes:
>
> > Is there any way to read out the compile-time HZ value of the kernel?
> >
> > I had a brief look at /proc/* and didn't find anything.
>
> Look again, this time with a sick mind. Got your barf bag?
> Kubys made me do it.

;)

First of all thanks for your recommended solution.

> /* actual values used by 2.4 kernels: 32 64 100 128 1000 1024 1200 */
> switch(h){
> case 30 ... 34 : Hertz = 32; break; /* ia64 emulator */
> case 48 ... 52 : Hertz = 50; break;
> case 58 ... 62 : Hertz = 60; break;
> case 63 ... 65 : Hertz = 64; break; /* StrongARM /Shark */
> case 95 ... 105 : Hertz = 100; break; /* normal Linux */
> case 124 ... 132 : Hertz = 128; break; /* MIPS, ARM */
> case 195 ... 204 : Hertz = 200; break; /* normal << 1 */
> case 253 ... 260 : Hertz = 256; break;
> case 393 ... 408 : Hertz = 400; break; /* normal << 2 */
> case 790 ... 808 : Hertz = 800; break; /* normal << 3 */
> case 990 ... 1010 : Hertz = 1000; break; /* ARM */
> case 1015 ... 1035 : Hertz = 1024; break; /* Alpha, ia64 */
> case 1180 ... 1220 : Hertz = 1200; break; /* Alpha */

As this is some kind of solution, it is not really generic enough.
Nobody is prevented from setting his Hz value to 500 or any number coming
to his mind (i.e. when he wants to do something nasty with TBF of tc).

And if you actually look at x86-user-mode-linux, it is 20...

-- 
Live long and prosper
- Harald Welte / laforge@gnumonks.org               http://www.gnumonks.org/
============================================================================
GCS/E/IT d- s-: a-- C+++ UL++++$ P+++ L++++$ E--- W- N++ o? K- w--- O- M- 
V-- PS+ PE-- Y+ PGP++ t++ 5-- !X !R tv-- b+++ DI? !D G+ e* h+ r% y+(*)
-
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:51 EST