20 mpstat Commands Examples in Linux / UNIX | mpstat Commands Tutorial

If you are using SMP (Multiple CPU) system, use mpstat command to display the utilization of each CPU individually.
mpstat Report processors related statistics which includes Collecting and displays performance statistics for all logical processors in the system.. This display CPU statistics of individual CPU (or) Core.
How to install mpstat?
1. Ensure you are logged in as ‘root’
‘mpstat’ and ‘vmstat’ are apart of the ‘sysstat’ package and should be installed by default
2. Verify installation :
# rpm -qa | grep -i sysstat
3. Installation, if needed :
# rpm -ivh <name>
4. If you have connectivity to RHN or a Satellite Server:
# yum install sysstat
5. If you are using Ubantu:
# apt-get install sysstat

Usage:

1. Using mpstat command without any option, will display the Global Average Activities by All CPUs.
$ mpstat
2. Using mpstat with option ‘-P’ (Indicate Processor Number) and ‘ALL’, will display statistics about all CPUs one by one starting from 0. 0 will the first one.
$ mpstat -P ALL
3. To display the statistics for N number of iterations after n seconds interval with average of each cpu use the following command.
$ mpstat -P ALL 2 5
4. The option ‘I’ will print total number of interrupt statistics about per processor.
$ mpstat -I
5. Get all the above information in one command i.e. equivalent to “-u -I ALL -p ALL”.
$ mpstat -A
Reference
Tagged : / / / / / / / / /