mpstat - Report Statistics for Individual or Combined Processors

Used to monitor CPU utilization on the system. The mpstat command writes the status of each available processor to standard output; by default the first processor is processor 0. A global average status across all processors is also given in the report. mpstat can be used on both SMP and UP machines, but on a UP machine only the global average status is printed. If no specific behavior is selected, CPU utilization is reported by default

Installation

apt-get install sysstat

Syntax

P specifies the CPU number

3 print a report every 3 seconds

5 print 5 times in total

Example

mpstat -P ALL

Linux 2.6.32-openvz-042stab093.4-amd64 (91) 10/21/2014 _x86_64_ (2 CPU)

22:54:42

CPU

%usr

%nice

%sys

%iowait

%irq

%soft

%steal

%guest

%idle

22:54:42

all

0.04

0.00

0.05

0.27

0.00

0.00

0.00

0.00

99.63

14:48:45

0

0.24

0.00

0.04

0.00

0.00

0.00

0.00

0.00

99.72

14:48:45

1

0.23

0.00

0.04

0.00

0.00

0.00

0.00

0.00

99.74

  • %usr: shows the percentage of CPU utilization spent executing at the user level (e.g. applications)

  • %nice: shows the percentage of CPU utilization spent executing at the user level with a nice priority

  • %sys: shows the percentage of CPU utilization spent executing at the system level (e.g. the kernel)

  • %iowait: shows the percentage of time the CPU was idle while the system had an outstanding disk I/O request

  • %irq: shows the percentage of time the CPU spent servicing hardware interrupts

  • %soft: shows the percentage of time the CPU spent servicing software interrupts

  • %steal: shows the percentage of time a virtual CPU spent in involuntary wait while the hypervisor was servicing another virtual processor

  • %guest: shows the percentage of time the CPU spent running a virtual processor

  • %idle: shows the percentage of time the CPU was idle while the system had no outstanding disk I/O requests