Linux HZ checker

22 01 2008

HZ defined how many ticks the internal timer interrupt in 1sec, which means the number of jiffies count in 1 sec.

Different architecture/machine may have different HZ value, you can check using this script from the timer interrupt:

while [ 1 ]; do
A=`cat /proc/interrupts | grep timer | cut -d ‘:’ -f 2 |sed -e ‘s/[^0-9]//g’`
sleep 1
B=`cat /proc/interrupts | grep timer | cut -d ‘:’ -f 2 |sed -e ‘s/[^0-9]//g’`
echo “HZ:$C”

it is around 250 in my desktop running 2.6, but 100 in my mips 2.4 embedded board.

Sometimes we may need to know the time in seconds from jiffies in kernel.

time(sec) = jiffies/HZ;