HOME SOFTWARE CONSULTANCY TRAINING REFERENCE PARTNERS SEARCH
spacer
Latest Tips
e-business
ITIL
Linux
Management
Modeling
Oracle
SQL
UNIX
Windows
z/OS
 
 
 
spacer
 

John Ellerslie writes; I received a copy of the last set of performance tips, which included advice on how to get the number of CPUs on various UNIX systems.

On Tru64, an alternate command is '/usr/sbin/sizer -p'.
On HP-UX, you can get the info without superuser privileges using '/etc/ioscan -k -C processor | grep processor | wc -l'

Also get memory using:

AIX: lsattr -El sys0 -a realmem
HP: /usr/local/bin/get_ram
Solaris: /usr/sbin/prtconf | grep "Memory size"
Tru64: vmstat -P | grep "Total Physical Memory =" | head -1

James Collings says...
There is a way to get this information (and more) from HP-UX without requiring superuser privileges

The following "C" program will do this:
=====================================================
/* Procspeed by James Collings, Future Star Services 2001 */
#include <stdio.h>
#include <string.h>
#include <sys/pstat.h>
#include <sys/param.h>
#include <sys/unistd.h>

main () {
{
struct pst_dynamic psd;
struct pst_processor *psp;

if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) != -1) {
size_t nspu = psd.psd_proc_cnt;
psp = (struct pst_processor *)malloc(nspu * sizeof(*psp));
if (pstat_getprocessor(psp, sizeof(*psp), nspu, 0) != -1) {
int i;
for (i = 0; i < nspu; i++) {
int hurts = psp[i].psp_iticksperclktick;
printf("%d Mhz proc #%d\n", hurts/10000, i);
}
}
else
perror("pstat_getdynamic");
}
else
perror("pstat_getdynamic");
}
}

The above program (when compiled on any HP-UX system) will return the speed (in MHz) of each processor within the system. Since Capacity Planners very rarely have superuser rights to their servers, I thought your readers might find this a useful tool.


Adrian Blant says…

On the 'How many processors on a Unix box'. Try:

Solaris -> mpstat and add them up !!
HP-UX -> sar -M 1 1 and add them up

Not as exciting as using abd and debug commands but it works for me...

Also, if you have logged into a HP box that you don't know what it is try 'model' as well as uname -a. Model will tell you the computer model number and sometimes the chip speed

eg.
>model
>9000/800/L1000-36 (this means '9000 server 800 / model L1000 - 360MHz CPU)

Next UNIX Tip