Reading the CPU speed in HP-UX

For many years, this was the standard method to obtain the CPU clock speed in HP-UX:

echo “itick_per_usec/D” | adb -k /stand/vmunix /dev/kmem

Then take the number and divide it by 10000 (10k).

It turns out that itick_per_usec
never shows the processor’s core frequency, it always shows the processors itimer frequency. It’s just that up until the Montecito (IA64/Itanium/Integrity) processors these values were always the same. The command: machinfo is the correct method for getting this info. Here is a small script that will obtain the CPU speed in MHz for all processors and HP-UX versions from version 9 and later:

#!/usr/bin/sh

###############

# CPU SPEED #

###############

set -u

MYREV=$(uname -r|awk -F . ‘{print $2$3}’)

if model | grep -qi IA64

then

MACHINFO=$(/usr/contrib/bin/machinfo)

if [ $MYREV -ge 1131 ]

then

echo “$MACHINFO” |

awk -F “(” ‘/Intel(R)/{print $3}’ |

read SPEED METRIC EXTRA

if [ $(echo “$METRIC” | grep -c GHz) -gt 0 ]

then

MHZ=$(echo $SPEED*1000 | bc | cut -f1 -d.)

else

MHZ=$SPEED

fi

else

MHZ=$(echo “$MACHINFO” |

awk ‘/Clock speed/{print ($4+1)/10000}’)

fi

else

&& ADBOPT=”-k” || ADBOPT=””

MHZ=$(echo itick_per_tick/D |

adb $ADBOPT /stand/vmunix /dev/kmem |

grep tic |

tail -1 |

awk -F : ‘{print $2/10000}’)

fi

echo “$(hostname): MHZ=$MHZ”

– See more at: http://serviceitdirect.com/blog/reading-cpu-speed-hp-ux#sthash.VCgsrNhA.dpuf


Tags: