Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2008-06-12
5
Medium Priority
?
2,651 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 500 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 500 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

610 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