Q. My AMD sever is quad processor with SMP kernel, How do I display the utilization of each CPU individually?
A. Linux can display each multiple SMP CPU processors utilization individually using mpstat command.
The mpstat command displays output activities for each available processor, processor 0 being the first one. Global average activities among all processors are also reported. The mpstat command can be used both on SMP and UP machines, but in the latter, only global average activities will be printed.
# mpstat -P ALL.
Where, -P cpu | ALL option indicate the processor number for which statistics are to be reported. cpu is the processor number. Note that processor 0 is the first processor. The ALL keyword indicates that statistics are to be reported for all processors.
Linux 2.6.9-55.ELsmp (server.xyz.com) 06/11/2007 04:13:29 PM CPU %user %nice %system %iowait %irq %soft %idle intr/s 04:13:29 PM all 5.63 0.01 2.33 0.85 0.01 0.10 91.06 2255.03 04:13:29 PM 0 5.74 0.00 2.17 0.88 0.01 0.15 91.05 1170.16 04:13:29 PM 1 5.53 0.01 2.49 0.83 0.01 0.06 91.07 1084.87
Understanding mpstat output
The report generated by the mpstat command has the following format:
- CPU: Processor number. The keyword all indicates that statistics are calculated as averages among all processors.
- %user: Show the percentage of CPU utilization that occurred while executing at the user level (application).
- %nice: Show the percentage of CPU utilization that occurred while executing at the user level with nice priority.
- %system: Show the percentage of CPU utilization that occurred while executing at the system level (kernel). Note that this does not include the time spent servicing
interrupts or softirqs.
- %iowait: Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.
- %irq: Show the percentage of time spent by the CPU or CPUs to service interrupts.
- %soft: Show the percentage of time spent by the CPU or CPUs to service softirqs. A softirq (software interrupt) is one of up to 32 enumerated software interrupts
which can run on multiple CPUs at once.
- %idle: Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.
- intr/s: Show the total number of interrupts received per second by the CPU or CPUs.
Display five reports of global statistics among all processors at two second intervals, enter:
# mpstat 2 5
Display five reports of statistics for all processors at two second intervals, enter:
# mpstat -P ALL 2 5