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
🐧 1 comment so far... add one ↓
|Category||List of Unix and Linux commands|
|Disk space analyzers||df • ncdu • pydf|
|File Management||cat • tree|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||NetHogs • dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|