Linux CPU Real-time monitoring command Mpstat introduction

Source: Internet
Author: User

1, Introduction
Mpstat isMultiprocessor StatisticsThe abbreviation, isreal-time system monitoring tools。 Its reports are some of the CPU's statistics, which are stored in the/proc/stat file. In a multi-CPUs system, it not only can view the average status information of all CPUs, but also can view the information of specific CPU. Mpstat's biggest feature is the ability to view statistics for each compute core in a multi-core CPU, while a tool like Vmstat can only view the overall CPU of the system.

2, installation
[Email protected] ~]# Mpstat
-bash:mpstat:command not found
[Email protected] ~]# Mount-o loop-t iso9660/dev/cdrom/mnt/cdrom
[Email protected] ~]# cd/mnt/cdrom/server/
[Email protected] server]# RPM-IVH sysstat-7.0.2-3.el5.i386.rpm
Warning:sysstat-7.0.2-3.el5.i386.rpm:header V3 DSA Signature:nokey, key ID 37017186
Preparing ... ########################################### [100%]
1:sysstat ########################################### [100%]

3, example
Usage
MPSTAT-V Display Mpstat version information
Mpstat-p all displays all CPU information
Mpstat-p N shows nth Cup information, n is number, count starting from 0
Mpstat N m displays CPU information once per n seconds, continuously displays m times, and finally shows an average
Mpstat N Displays the CPU information once per n seconds and continues to display

To view detailed current health information for each CPU core, the output is as follows:
[Email protected] ~]# mpstat-p all
Linux 2.6.18-194.el5 (ora10g.up.com) 11/05/14
09:13:02 CPU%user%nice%sys%iowait%irq%soft%steal%idle intr/s
09:13:02 all 0.62 0.01 0.54 3.48 0.00 0.02 0.00 95.32 1039.58
09:13:02 0 0.92 0.01 1.18 8.77 0.01 0.05 0.00 89.06 1030.23
09:13:02 1 0.27 0.00 0.31 1.46 0.00 0.01 0.00 97.96 1.00
....
09:13:02 14 1.12 0.02 0.45 2.99 0.00 0.01 0.00 95.39 7.74
09:13:02 15 0.18 0.00 0.22 0.70 0.00 0.01 0.00 98.90 0.59

View current health information for multicore CPU cores, updated every 2 seconds
[[email protected] ~]# Mpstat-p all 2

View the usage of a CPU, value in [0,cpu number-1]
[Email protected] ~]# Mpstat-p 2
Linux 2.6.18-194.el5 (ora10g.up.com) 11/05/14
10:19:28 CPU%user%nice%sys%iowait%irq%soft%steal%idle intr/s
10:19:28 2 0.08 0.00 0.04 0.22 0.00 0.01 0.00 99.64 0.55

View current health information for multicore CPU cores, updated every 2 seconds, showing 5 times
[[email protected] ~]# Mpstat-p all 2 5

4, the field has the following meanings
English Explanation:
Cpu:processor number. The keyword all indicates that statistics is 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 the CPU utilization that occurred while executing at the user level with a nice priority.
%sys:show the percentage of CPU utilization that occurred while executing at the system level (kernel). Note that
This does not include time spent servicing interrupts or Softirqs.
%iowait:show the percentage of time and the CPU or CPUs were idle during which the system had an outstanding disk I/O RE Quest.
%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 + enumerated software interrupts which can run on multiple CPUs at once.
%steal:show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor is Ser-vici Ng another virtual processor.
%idle:show the percentage of time that the CPU or CPUs were idle and the system do not has an outstanding disk I/O requ Est.
Intr/s:show The total number of interrupts received per second by the CPU or CPUs.

Parameter interpretation get data from/proc/stat
CPU Processor ID
User's CPU time in internal time period (%), does not include the nice value is negative process (usr/total) *100
Nice in the internal time period, the nice value is the CPU time of the negative process (%) (nice/total) *100
System in internal time period, core time (%) (system/total) *100
Iowait in internal time period, HDD io wait Time (%) (iowait/total) *100
IRQ in internal time period, hard interrupt Time (%) (irq/total) *100
Soft in internal time period, soft interrupt time (%) (softirq/total) *100
Idle during the internal time period, the CPU drops idle time (%) for any reason other than waiting for a disk IO operation (%) (idle/total) *100
INTR/S the number of interrupts received by the CPU per second in the internal time period intr/total) *100

Total CPU Working time =TOTAL_CUR=USER+SYSTEM+NICE+IDLE+IOWAIT+IRQ+SOFTIRQ
total_pre=pre_user+ pre_system+ pre_nice+ pre_idle+ pre_iowait+ pre_irq+ PRE_SOFTIRQ
User=user_cur–user_pre
Total=total_cur-total_pre
Where _cur represents the current value, and _pre represents the value before interval time. All values in the table above are desirable to a two-bit decimal point.

Linux CPU Real-time monitoring command Mpstat introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.