Operating System - HP-UX
1834313 Members
2195 Online
110066 Solutions
New Discussion

Universal way to find out number of CPU's

 
SOLVED
Go to solution
Banibrata Dutta_1
Occasional Contributor

Universal way to find out number of CPU's

that are configured in the host, and that are physically present but not configured!!

thanks,
bdutta
22 REPLIES 22
Robert-Jan Goossens
Honored Contributor

Re: Universal way to find out number of CPU's

Hi,

I don't have a server to test it (mine are running with all cpu's configured) but you could try with

# ioscan -fncprocessor
Class I H/W Path Driver S/W State H/W Type Description
===================================================================
processor 0 160 processor CLAIMED PROCESSOR Processor
processor 1 166 processor CLAIMED PROCESSOR Processor

Regards,
Robert-Jan
Banibrata Dutta_1
Occasional Contributor

Re: Universal way to find out number of CPU's

hi robert:

on my host "ioscan -fncprocessor", gives --
ioscan: illegal option -- c
ioscan: illegal option -- p
ioscan: illegal option -- r
ioscan: illegal option -- o
ioscan: illegal option -- c
ioscan: illegal option -- e
ioscan: illegal option -- s
ioscan: illegal option -- s
ioscan: illegal option -- o
ioscan: illegal option -- r

although uname -a returns the following:-

HP-UX ochpt17 B.11.11 U 9000/800 548301562 unlimited-user license

thanks,
bdutta
Victor Fridyev
Honored Contributor

Re: Universal way to find out number of CPU's

Hi
Robert-Jan is right, with ioscan you can see number of CPUs, which work on your machine.
You can't see "hidden" CPU (not activated), e.g on rp34xx.
Entities are not to be multiplied beyond necessity - RTFM
gerjam
Advisor

Re: Universal way to find out number of CPU's

ioscan -fnC processor, Robery just missed the space :)
Fred Ruffet
Honored Contributor
Solution

Re: Universal way to find out number of CPU's

C option is uppercase :

>ioscan -fkn -C processor
Class I H/W Path Driver S/W State H/W Type Description
===================================================================
processor 0 160 processor CLAIMED PROCESSOR Processor
processor 1 162 processor CLAIMED PROCESSOR Processor
processor 2 164 processor CLAIMED PROCESSOR Processor
processor 3 166 processor CLAIMED PROCESSOR Processor

issuing "ioscan -fkn -C processor|tail +3|wc -l" will give you the count...

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Shaikh Imran
Honored Contributor

Re: Universal way to find out number of CPU's

Hi,

One more option addition to the above all

If diagnostics is installed then
You can try stm also.
The information will give you the required
details.

Regards,

I'll sleep when i am dead.
Ravi_8
Honored Contributor

Re: Universal way to find out number of CPU's

Hi,

#ioscan -fnC processor
never give up
Muthukumar_5
Honored Contributor

Re: Universal way to find out number of CPU's

You can use mpsched -s to know system process count there.

see man mpsched
Easy to suggest when don't know about the problem!
Robert-Jan Goossens
Honored Contributor

Re: Universal way to find out number of CPU's

Sorry Bdutta,

Yes ioscan should have been with a capital C

# ioscan -fnCprocessor

If you have stm installed on your systems you also try

# echo "selclass qualifier cpu;infolog" | /usr/sbin/cstm | grep "CPU Module"

Best regards,
Robert-Jan
Geoff Wild
Honored Contributor

Re: Universal way to find out number of CPU's

If you are talking about icod, then:

icod_stat -a

will show active cpus, and

icod_stat -i

will show inactive ones.

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.
HGN
Honored Contributor

Re: Universal way to find out number of CPU's

Hi

You can use

ioscan -fnC processor which will give you the details

Rgds

Gopi
Prashant Zanwar_4
Respected Contributor

Re: Universal way to find out number of CPU's

sar -M -u will also give you number of CPU's you are using.

top also gives you number of cpu's

ioscan -fnC processor gives you cpu's

sam also gives you number of cpu's in system properties.

There are many ways like this to find number of CPU's

Hope this helps
Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Prashant Zanwar_4
Respected Contributor

Re: Universal way to find out number of CPU's

Also /opt/ignite/bin/print_manifest gives you all the system information.

Hope this helps
Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Bill Hassell
Honored Contributor

Re: Universal way to find out number of CPU's

None of the commands (print_manifest, top, mpsched, sar, ioscan) will show unconfigured or disabled processors. I think the newer online diagnostics will show disabled or unconfigured processors, but otherwise, you'll only see the working CPUs.


Bill Hassell, sysadmin
Prashant Zanwar_4
Respected Contributor

Re: Universal way to find out number of CPU's

Yes I agree with bill..I am sorry if I mislead you somewhere..that was information about active/working processor..

Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Shine_5
Frequent Advisor

Re: Universal way to find out number of CPU's

you could use:

#ioscan -fnkCprocessor | grep processor | wc -l

Also the top command could help you. type:
#top

and you will see the Cpu states with their number

regards
Shine
Geoff Wild
Honored Contributor

Re: Universal way to find out number of CPU's

As I said - with ICOD:

icod_stat - display instant Capacity on Demand (iCOD) processor
status, usage information, and system information

Run it by itself, gives some systme info as well as:

Total processors: 6
Active processors: 5
Inactive processors that can be activated: 1
Inactive processors that cannot be activated: 0
Deconfigured processors: 0
Requested active processors: 5


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.
Jeff Schussele
Honored Contributor

Re: Universal way to find out number of CPU's

Hi bdutta,

I just checked a system with deconfigured CPUs & the STM suite will indeed show active & deconfigured CPUs as well as which CPU is the Monarch.
I was in xstm & selected System -> Tools -> Information -> Run
Version of OnLineDiag/STM was 11.11.14.14 & the system was an N4000-44

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jeff Schussele
Honored Contributor

Re: Universal way to find out number of CPU's

Oops - sorry version of OnlineDiag / STM was 11.11.14.15

Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Robert Ibatullin
New Member

Re: Universal way to find out number of CPU's

I try some of commands, and I have some problems with that: 1) I need command without admin permition 2) With output (to read from my applecation) 3) Universal (compatible for most Unix's). Can somebody recomend me command to do that?

Thanks,
Robert
Bill Hassell
Honored Contributor

Re: Universal way to find out number of CPU's

1) I need command without admin permition

top is the only command that will do this without root privileges


2) With output (to read from my applecation)

top can be run with -d 1 to provide one output screen. Unfortunately, top demands a valid terminal (it doesn't run in batch mode).


3) Universal (compatible for most Unix's).

Not possilble. The concept of multi-processor systems within Unix is implemented very differently, and as is true with all Unix systems, the system administration commands are very seldom compatible. You'll have to put in a lot of if-then-else code to handle each Unix system.


Bill Hassell, sysadmin
Gregory Fruth
Esteemed Contributor

Re: Universal way to find out number of CPU's

There's no standardized cross-platform
way to get the number of CPUs. Each platform
will be different. On HP-UX you can use
pstat_getdynamic() to get the number of
active CPUs (pst_dynamic.proc_cnt). Perhaps
there's a field in pstat_getstatic() or
somesuch which gives the total number of CPUs.