Solved

How to determine the value of HZ / jiffy at runtime from the command line?

Posted on 2008-06-12
5
2,338 Views
Last Modified: 2013-12-06
Hi,

I'm writing a Perl script that reads various time values in jiffies from a Redhat Enterprise Linux installation's procfs. I need to convert these values to seconds.

The question: How do I get my kernel's HZ or jiffy value reliably from within the script? The method should be as standard as possible. The kernel version can be 2.4.* or 2.6.*. I can invoke any standard Linux tools from the script - so this really is not a perl specific question.

Thanks in advance!

0
Comment
Question by:arv2008
5 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 125 total points
ID: 21776788
Unfortunately I don't know, but
- refer /proc/uptime /proc/stat files
- refer source code for uptime from procps package
- note that recent kernels (2.6.20+) introduced tickless kernel, which made HZ obsolete(no longer used).
0
 
LVL 40

Assisted Solution

by:noci
noci earned 125 total points
ID: 21776817
IF your kernel config is available you can read it....

For kernels 2.6+ that have their config exposed in the procfs filesystem:
    zgrep CONFIG_HZ /proc/config.gz

For Redhat v2.4 kernels they were supplied as file in the /boot directory.

As it is a compile time constant (for the kernel).

And there is this example.....:)   http://www.ibm.com/developerworks/linux/library/l-system-calls/
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
centos commands 6 87
combine Mutt command with a select statement to distribute file in Linux 2 47
Redhat upgrade 1 47
exchange, squid, proxy, linux 6 28
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question