Solved

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

Posted on 2008-06-12
5
2,424 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

696 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