1836517 Members
2167 Online
110101 Solutions
New Discussion

CPU number

 
SOLVED
Go to solution
Tonatiuh
Super Advisor

CPU number

HP-UX 11.11. How to know the number of CPUs (microprocesors) in my server?
10 REPLIES 10
Coolmar
Esteemed Contributor

Re: CPU number

'top' will give you that information - look at the top where it says CPUs, before you get to all the processes.

Also stm (xstm for GUI) will also tell you.

Sally
Biswajit Tripathy
Honored Contributor
Solution

Re: CPU number

# ioscan -nfkC processor

- Biswajit
:-)
Rick Garland
Honored Contributor

Re: CPU number

ioscan -k|grep processor|wc -l
Steve Lewis
Honored Contributor

Re: CPU number

Or in a C program:

/* returns the number of cpus installed */

#include

int main()
{

return mpctl(MPC_GETNUMSPUS,0,0);

}
Peter Godron
Honored Contributor

Re: CPU number

Hi,
if running as root:
use SAM
or
echo runningprocs/D | adb -k
/stand/vmunix /dev/mem
Processor speed:
echo itick_per_usec/D | adb -k
/stand/vmunix /dev/mem
If you have access to perl:
Processor Speed:
perl -e 'local($PSTAT, $PSTAT_PROCESSOR)=(239,10);
local($struct_pst_processor)=("L30");
local($cpu_info, $cpu_ticks);
$cpu_info = "\0" x 120;
syscall($PSTAT, $PSTAT_PROCESSOR, $cpu_info, length($cpu_info), 1, 0);
($cpu_ticks)=(unpack($struct_pst_processor, $cpu_info))[26];
print "speed=".int($cpu_ticks/10000)."\n";'
(Thanks to Nancy Rippey)

Regards
Jeff Carlin
Frequent Advisor

Re: CPU number

Attached is a script that will display the number and speed of your CPU's...

i.e.:
2 CPU(s) @ 550 Mhz

The output is than awk-able for use in other scripts.
Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.
Tonatiuh
Super Advisor

Re: CPU number

Excelent script Jeff!
Jeff Carlin
Frequent Advisor

Re: CPU number

Thanks, but the adb parts were found elsewhere in this *excellent* forum. My colleague Jose found those and created the base script.

I have another one that is also helpful determining the amount of memory in use and total installed. It shows the following when run:

46 %used ( 2267 Mb free ) 4096 Mb physical

We run a mixed shop here, so it was written to run on HP, SUN & AIX. Enjoy!
Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.
Tonatiuh
Super Advisor

Re: CPU number

Really Good Jeff. Thanks!
Anthony Lennan
Valued Contributor

Re: CPU number

Hi Tonatiuh,

Just a quick note in case you're running vpars or npars:

If you're running virtual partitions most of the above methods will only show the CPU's that are allocated for that partition. If you actually want to know the number of physical CPU's available across all vpars you can use the vparstatus command and look at the max number of cpu's.

If you're using npars and you want to know the total number of CPU's across all partitions I think the easiest way would be to use the GSP commands.

Rgds,
Anthony