kernel:how to modify and read the tick rate:HZ


 
Thread Tools Search this Thread
Operating Systems Linux kernel:how to modify and read the tick rate:HZ
# 1  
Old 01-08-2008
kernel:how to modify and read the tick rate:HZ

hi,

one of our customer is facing an issue with jiffies wrap up.
on a 32 bit machine, the variable jiffies count upto 472 days.
the customer's server was up for 472 days ('uptime') and to reproduce
the same, i tried to change the variable HZ in linux-2.6..23.9/include/asm-i386/param.h
from 100 to 10000.
after which i rebuilt the kernel with following steps:
# make oldconfig
# make modules_install
# make install

Now when i boot from this newly built kernel, i wrote a small kernel module
to read the jiffies and HZ global variable,which is as follows:

[root@localhost drivers]# cat get_jiffies.c
#include <linux/init.h>
#include <linux/module.h>
#include <asm/current.h>
#include <linux/sched.h>
#include <linux/time.h>
#include <linux/jiffies.h>
static int __init jiffies_init(void)
{
unsigned long j,z;
j = z = 0;
j = jiffies;
z = HZ;
printk(KERN_ALERT "jiffies value is %lu\n",j);
printk(KERN_ALERT "jiffies value in seconds %lu\n",(jiffies/HZ));
printk(KERN_ALERT "HZ value is %lu\n",z);
return 0;
}

static void __exit jiffies_exit(void)
{
printk(KERN_ALERT "Goodbye, world!\n");
}

module_init(jiffies_init);
module_exit(jiffies_exit);

MODULE_LICENSE("GPL");

[root@localhost drivers]# insmod get_jiffies.ko
[root@localhost drivers]# dmesg
jiffies value is 372939
jiffies value in seconds 1491
HZ value is 250 <====

why this HZ variable is shown as 250 ?
i am a newbie in kernel programming and i might be doing something really stupid as well.


~amit
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

C++ Attempting to modify this function to read from a (;) semi-colon-separated file

After some thought. I am uncomfortable issuing my professors name where, there may be unintended side effects from any negative responses/feedback. Willing to re post if I can omit school / professor publicly, but can message moderator for validation? I am here for knowledge and understanding,... (1 Reply)
Discussion started by: briandanielz
1 Replies

2. Windows & DOS: Issues & Discussions

Clock doesn't tick

This is a strange one, I've never seen anything like it; the realtime clock doesn't tick while the computer's idle, only when you're watching it. Leave for 3 hours and it'll be 3 hours off. It still advances when it's off however, or the time would be far more incorrect than it is. About all... (10 Replies)
Discussion started by: Corona688
10 Replies

3. Shell Programming and Scripting

Read data from .csv file through shell script & modify

I need to read data from a file called "test.csv" through shell script where the file contains values like name,price,descriptor etc. There are rows where descriptor (& in some rows name) are written as string & other characters like "car_+" OR "bike*" etc where it should contains strings like... (3 Replies)
Discussion started by: raj100
3 Replies

4. Solaris

Which file is read by kernel to set its default system kernel parameters values?

Hi gurus Could anybody tell me which file is read by kernel to set its default system kernal parameters values in solaris. Here I am not taking about /etc/system file which is used to load kernal modules or to change any default system kernal parameter value Is it /dev/kmem file or something... (1 Reply)
Discussion started by: girish.batra
1 Replies

5. Programming

Understanding read/write and kernel interaction

Ok, so I'm trying to finalize my understanding of read/write and kernel interaction. read(): You have a library function that has as it's first parameter (what the open file to read from is), second parameter( a pointer to a buffer (is this the location of a buffer in the user area or the... (7 Replies)
Discussion started by: Krothos
7 Replies

6. UNIX for Dummies Questions & Answers

Understanding read/write and kernel interaction

Ok, so I'm trying to finalize my understanding of read/write and kernel interaction. read(): You have a library function that has as it's first parameter (what the open file to read from is), second parameter( a pointer to a buffer (is this the location of a buffer in the user area or the... (1 Reply)
Discussion started by: Krothos
1 Replies

7. UNIX for Dummies Questions & Answers

How to read freebsd kernel source?

I got the freebsd kernel source from the first install CD(in directory:\7.0-RELEASE\src\),isn't right? if so,how can i read it? Is there any tools? (4 Replies)
Discussion started by: zhouq3132
4 Replies

8. UNIX for Advanced & Expert Users

How to read freebsd kernel source?

I got the freebsd kernel source from the first install CD(in directory:\7.0-RELEASE\src\),isn't right? if so,how can i read it? Is there any tools? (1 Reply)
Discussion started by: zhouq3132
1 Replies

9. Shell Programming and Scripting

How to read a specific section and modify within

Hi, I am n00b to shell scripting and I am learning Ksh, sed and awk. I have a requirement and need your help. 1) How to read a specific section of a file. I have a file and I want to read the contents between say "Page Number:1" to "End of Page 1" 2) Within the section of the file that was... (2 Replies)
Discussion started by: kn.naresh
2 Replies

10. UNIX for Advanced & Expert Users

HELP! Need 2 Write a program which will read in a tax rate (as a percentage) and the

I need this ASAP...don't know where else to turn... Thanx in advance :) (2 Replies)
Discussion started by: 1TruLuv
2 Replies
Login or Register to Ask a Question