On Sat, 1 Aug 2009, Greg KH wrote:
> The following C program should properly show you the kernel HZ.
>
> thanks,
>
> greg k-h
>
> --------------
>
> #include <unistd.h>
> #include <time.h>
> #include <stdio.h>
>
> int main()
> {
> struct timespec res;
> double resolution;
>
> printf("UserHZ %ld\n", sysconf(_SC_CLK_TCK));
>
> clock_getres(CLOCK_REALTIME, &res);
> resolution = res.tv_sec + (((double)res.tv_nsec)/1.0e9);
>
> printf("SystemHZ %ld\n", (unsigned long)(1/resolution + 0.5));
> return 0;
> }
actually, it just occurred to me that i can use the creation of a
/proc/hz file the basis for a future newbie column on /proc files.
two birds with one stone, and all that.
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Annoying Kernel Pedantry.
Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
"Kernel Newbie Corner" column @ linux.com: http://cli.gs/WG6WYX
========================================================================
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ