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
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I need this ASAP...don't know where else to turn...
Thanx in advance :) (2 Replies)
Discussion started by: 1TruLuv
2 Replies
2. Shell Programming and Scripting
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
3. UNIX for Advanced & Expert Users
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
4. UNIX for Dummies Questions & Answers
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
5. UNIX for Dummies Questions & Answers
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
6. Programming
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
7. Solaris
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
8. Shell Programming and Scripting
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
9. Windows & DOS: Issues & Discussions
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
10. Homework & Coursework Questions
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
LEARN ABOUT HPUX
strmsgsz
STRMSGSZ(5) File Formats Manual STRMSGSZ(5)
NAME
STRMSGSZ - maximum size of streams message data (bytes)
VALUES
Failsafe
Default
Allowed values
Recommended values
DESCRIPTION
This tunable limits the number of bytes of message data that can be inserted by or in the data portion of any streams message on the sys-
tem. If the tunable is set to zero, there is no limit on how many bytes can be placed in the data segment of the message.
returns if the buffer being sent is larger than the current value of segments the data into multiple messages.
Who Is Expected to Change This Tunable?
Any customer.
Restrictions on Changing
Changes to this tunable take effect at next reboot.
When Should the Value of This Tunable Be Raised?
The tunable should be increased by any customer if the customer's STREAMS module/driver(s) require a longer message size in the data por-
tion than the current value.
What Are the Side Effects of Raising the Value of This Tunable?
The kernel will use more memory. During low memory situations, it may bring down system performance due to frequent swapping.
When Should the Value of This Tunable Be Lowered?
The tunable could be lowered by any customer if the customer's STREAMS module/driver(s) do not require a longer message size in the data
portion than the current value.
What Are the Side Effects of Lowering the Value of This Tunable?
Possible improper functioning in any of the STREAMS module/driver(s). Possible performance degradation, particularly in networking.
What Other Tunable Should Be Changed at the Same Time as This One?
None.
WARNINGS
All HP-UX kernel tunable parameters are release specific. This parameter may be removed or have its meaning changed in future releases of
HP-UX.
Installation of optional kernel software, from HP or other vendors, may cause changes to tunable parameter values. After installation,
some tunable parameters may no longer be at the default or recommended values. For information about the effects of installation on tun-
able values, consult the documentation for the kernel software being installed. For information about optional kernel software that was
factory installed on your system, see at
AUTHOR
was developed by HP.
Tunable Kernel Parameters STRMSGSZ(5)