Solved

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

Posted on 2008-06-12
5
2,195 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 39

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now