Operating System - HP-UX
1833998 Members
1781 Online
110063 Solutions
New Discussion

Re: How to Know frequency of CPUs

 
Peeyush_1
Occasional Contributor

How to Know frequency of CPUs

Hi All,
How can I know frequency of CPUs on HP UX system ? Plz note that i don't have root priviledge. Like in Solaris command is
/usr/sbin/psrinfo -v
This command does not require root priviledge in solaris. Every general user can run this command. Please tell me same function command on HP UX system.
Thanks in Advance
Peeyush
13 REPLIES 13
Fabio Ettore
Honored Contributor

Re: How to Know frequency of CPUs

Hi,

launch SAM:

# sam ---> Performance Monitor ---> System Properties ---> clock frequency

Otherwise by commandline:

# echo itick_per_usec/D | adb -k /stand/vmunix /dev/mem

It will obtain a number which will be the CPU frequency.

HTH.

Best regards,
Ettore
WISH? IMPROVEMENT!
Todd McDaniel_1
Honored Contributor

Re: How to Know frequency of CPUs

Just an fyi... here is a great site for similar commands.

dynamic site you can compare 2 or more OSs...

http://bhami.com/rosetta.html


Another static site...
http://www.unixguide.net/unixguide.shtml
Unix, the other white meat.
Peeyush_1
Occasional Contributor

Re: How to Know frequency of CPUs

Hi,
SAM won't help me beacuse i am connected with server with telnet and command adb i think require root permission.
plz some other solution.
Regards,
Peeyush
Pete Randall
Outstanding Contributor

Re: How to Know frequency of CPUs

You can use this little script:

HPUX=/stand/vmunix

MHZ=$(echo itick_per_tick/D \
| adb -k $HPUX /dev/kmem \
| tail -1 \
| awk '{print $2/10000}')
echo $MHZ


Pete

Pete
Todd McDaniel_1
Honored Contributor

Re: How to Know frequency of CPUs

You can use sam from a telnet session, it will default to text TUI mode...

Thats all I use on my boxes...
Unix, the other white meat.
Geoff Wild
Honored Contributor

Re: How to Know frequency of CPUs

Yes - you need root access....

Here's a little script...

#!/bin/ksh
#
# Taken from the HP/UniGraphics FAQ
# You must be ROOT to execute this since it uses adb to
# examine the running kernel
#
GetKernelSymbol()
{
echo "$1/D" | \
adb -k $hpux /dev/kmem | \
tr "\012" " " | \
read junk junk2 kval
}
hpux=/hp-ux
rev=$(uname -r | cut -d. -f2)
if ((rev > 9)); then hpux=/stand/vmunix ;fi
/bin/uname -a
GetKernelSymbol "processor_count"
print CPU Count: $kval
GetKernelSymbol "itick_per_tick"
let speed=kval/10000
print CPU Speed: $speed MHz
if ((rev > 10)); then
print CPU HW Support: `getconf HW_CPU_SUPP_BITS`-bit
print Kernel Support: `getconf KERNEL_BITS`-bit
GetKernelSymbol "memory_installed_in_machine"
else
GetKernelSymbol "physmem"
fi
let mb=kval*4/1024 # convert pages to MB
print RAM Size: $mb MB
GetKernelSymbol "bufpages"
let mb=kval*4/1024 # convert pages to MB
print bufpages: $mb MB
GetKernelSymbol "maxuprc"
print maxuprc: $kval
GetKernelSymbol "maxvgs"
print maxvgs: $kval
GetKernelSymbol "maxfiles"
print maxfiles: $kval
GetKernelSymbol "max_thread_proc"
print max_thread_proc: $kval
GetKernelSymbol "nfile"
print nfile: $kval
GetKernelSymbol "nflocks"
print nflock: $kval
GetKernelSymbol "nproc"
print nproc: $kval
GetKernelSymbol "ninode"
print ninode: $kval
GetKernelSymbol "vfd_cw"
print shmmax: $kval
GetKernelSymbol "shmmni"
print shmmni: $kval
GetKernelSymbol "dbc_max_pct"
print dbc_max_pct: $kval

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Fabio Ettore
Honored Contributor

Re: How to Know frequency of CPUs

SAM starts as Terminal User Interface too.
Then it is not a problem if you are in telnet.

It is not possible to know it by a NOT-root user!

Best regards,
Ettore
WISH? IMPROVEMENT!
Bruno Ganino
Honored Contributor

Re: How to Know frequency of CPUs

In Solaris
kstat -m cpu_info

Bruno
Torino (Turin) +2H
Bruno Ganino
Honored Contributor

Re: How to Know frequency of CPUs

as root try this
echo itick_per_tick/D | adb /hp-ux /dev/kmem | tail -n1 \
| awk '{print $2 / 10000, "MHZ"}'
Torino (Turin) +2H
Tom Maloy
Respected Contributor

Re: How to Know frequency of CPUs

If the diagmond process is running, you can do this:

echo "selclass qualifier cpu;info;wait;infolog"|cstm

One of the output lines will look like this:

Instruction Cache [Kbyte]: N/A Processor Speed: 875000000

for an 875 MHz processor.

Tom
Carpe diem!
Tom Maloy
Respected Contributor

Re: How to Know frequency of CPUs

Forgot to mention that

echo "selclass qualifier cpu;info;wait;infolog"|cstm

does not require root access, but you may have to specify the full path of /usr/sbin/cstm.

Tom
Carpe diem!
RAC_1
Honored Contributor

Re: How to Know frequency of CPUs

As you do not have root access, use model command, the last part is cpu frequency in hertz. But not very relibale though.

anil
There is no substitute to HARDWORK
H.Merijn Brand (procura
Honored Contributor

Re: How to Know frequency of CPUs

My FAQ sais it all:

What is my CPU speed?

d3:/ 103 # echo itick_per_usec/D | adb -k /stand/vmunix /dev/mem
itick_per_usec:
itick_per_usec: 240
d3:/ 104 #

Or with Perl:

a5:/wrk 108 > perl -MUnix::Processors -le'print join"\t",$_->id,$_->state,$_->type,$_->clock for @{Unix::Processors->new()->processors}'
0 online HP PA-RISC 2.0 750
1 online HP PA-RISC 2.0 750
a5:/wrk 109 >

For the adb version one indeed does need root access. But you can get it without root access too, using a small C-program calling

if (pstat_getprocessor (&psp, sizeof (psp), 1, 0)) {
clock = psp.psp_iticksperclktick / 10000;
}

This is what the perl module does

My HP ITRC site pages can be found at (please use LA as primary choice):

USA Los Angeles http://mirrors.develooper.com/hpux/
SGP Singapore https://www.beepz.com/personal/merijn/
USA Chicago http://ww.hpux.ws/merijn/
NL Hoofddorp http://www.cmve.net/~merijn/

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn