?
Solved

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

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

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…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

752 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