Linux display each multiple SMP CPU processors utilization individually

Q. My AMD sever is quad processor with SMP kernel, How do I display the utilization of each CPU individually?

ADVERTISEMENTS

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.

Output:

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

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
1 comment… add one
  • marc riera May 17, 2010 @ 21:05

    Hello,

    there is any way to apply this discrete monitorization to ganglia?
    or in the other hand, if I have a grid and I would like to monitorize each core individually which solution will you suggest?

    many thanks. Great work/blog/divulgative staff.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.