Display the number of CPUs in HP/UX
In HP/UX the ioscan command is used to display the number of processors
available on the server.
root> ioscan -C processor | grep processor | wc -l
16
Display number of CPUs in Solaris
In Sun Solaris, the prsinfo command can be used to count the
number of CPUs on the processor.
root> psrinfo -v|grep “Status of processor”|wc -l
2
For details about the Solaris CPUs, the -v (verbose) option can
be used with the psrinfo command
root> psrinfo -v
Status of processor 0 as of: 12/13/00 14:47:41
Processor has been on-line since 11/05/00 13:26:42.
The sparcv9 processor operates at 450 MHz,
and has a sparcv9 floating point processor.
Status of processor 2 as of: 12/13/00 14:47:41
Processor has been on-line since 11/05/00 13:26:43.
The sparcv9 processor operates at 450 MHz,
and has a sparcv9 floating point processor.
Display number of CPUs in Linux
To see the number of CPUs on a Linux server, you can cat the
/proc/cpuinfo file. In the example below we see that our Linux server has
4 CPUs.
root> cat /proc/cpuinfo|grep processor|wc -l
4
Display number of CPUs in AIX
The lsdev command can be used to see the number of CPUs on an
IBM AIX server. Below we see that this AIX server has four CPUs:
root> lsdev -C|grep Process|wc -l
*********************************************************************************************************
To report the current CPU Activity
sar -u 1 5
sar utility can be used to provide various information about the server
resources.
In the above example the parameters used and the details are as mentioned
below
-u option is for CPU related information
1 is the frequency of execution of the command in seconds
5 is the number of times the command should be executed.
So the command displays the CPU information every 1 second for
5 times.
It reports the CPU related usage by the user(%usr), system(%sys), the CPU Wait
for I/O(%wio) and the Idle Percentage(%idle).
Sample Output
14:08:17 %usr %sys
%wio %idle physc
14:08:18 25
0
0
75
4.00
14:08:19 25
0
0
74
4.00
14:08:20 25
0
0
75
4.00
14:08:21 25
0
0
75
4.00
14:08:22 25
0
0
75
4.03
Average 25
0
0
75
4.01