Linux Mpstat commands

Source: Internet
Author: User

Mpstat is the abbreviation of multiprocessor statistics and is a real-time system monitoring tool. Reports some statistical information about the CPU, which is 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.

Grammar:

Mpstat [-P {| All}] [internal [count]]

Parameters:

(1)-P {| All}: indicates which CPU to monitor, and value in [0,cpu number-1];

(2) internal: The interval between the adjacent two samples;

(3) Count: number of samples, count can only be used with delay;

Note: when there are no parameters, Mpstat displays the average of all information after the system is started. When there is interval, the first line of information is the average information since the system started. Starting with the second line, the output is the average information for the previous interval time period.

Example:

(1) Display all CPU information: Mpstat-p all 1 (interval 1s)

(2) Display CPU information with ID 1: mpstat-p 1 1 (1s interval)

Result Description:

(1) User: in internal time period, the CPU time (%), does not contain the Nice value is negative process, the value is (usr/total) *100;

(2)Nice: In the internal time period, the nice value is the CPU time of the negative process (%), the value is (nice/total) *100;

(3) system: In the internal time period, the core time (%), the value is (system/total) *100;

(4) iowait: in the internal time period, the hard disk IO wait time (%), the value is (iowait/total) *100;

(5) IRQ: In the internal time period, the hard Interrupt time (%), the value is (irq/total) *100;

(6) Soft: In the internal time period, the soft interrupt time (%), the value is (softirq/total) *100;

(7) Idle: During the internal time period, the CPU drops idle time (%) for any reason other than waiting for the disk IO operation, the value is (idle/total) *100;

(8) intr/s: In the internal time period, the number of interrupts received by the CPU per second, the value is (intr/total) *100;

Example Description:

# Mpstat-p All 5 2
Linux 2.6.9-67.ELSMP (ORACLERAC1) 12/20/2008

10:42:38 PM CPU%user%nice%system%iowait%irq%soft%idle intr/s
10:42:43 PM All 6.89 0.00 44.76 0.10 0.10 0.10 48.05 1121.60
10:42:43 PM 0 9.20 0.00 49.00 0.00 0.00 0.20 41.60 413.00
10:42:43 PM 1 4.60 0.00 40.60 0.00 0.20 0.20 54.60 708.40

10:42:43 PM CPU%user%nice%system%iowait%irq%soft%idle intr/s
10:42:48 PM All 7.60 0.00 45.30 0.30 0.00 0.10 46.70 1195.01
10:42:48 PM 0 4.19 0.00 2.20 0.40 0.00 0.00 93.21 1034.53
10:42:48 PM 1 10.78 0.00 88.22 0.40 0.00 0.00 0.20 160.48

Average:cpu%user%nice%system%iowait%irq%soft%idle intr/s
Average:all 7.25 0.00 45.03 0.20 0.05 0.10 47.38 1158.34
average:0 6.69 0.00 25.57 0.20 0.00 0.10 67.43 724.08
Average:1 7.69 0.00 64.44 0.20 0.10 0.10 27.37 434.17

It shows various statistics about the CPU in the system. The –P all option indicates that the command displays statistics for all CPUs,
Not just statistics for specific CPUs. The parameter 5 2 indicates that the command runs every 5 seconds and runs 2 times.
The output above first shows the total metrics for all CPUs, and then shows the respective metrics for each CPU. Finally, the average of all CPUs is displayed at the end.

Let's take a look at the meaning of these column values:

%user represents the percentage of CPU that is used to process user processes. A user process is a non-kernel process for an application, such as an Oracle database.
In this example output, the user CPU percentage is very low.

%nice represents the percentage of the CPU when a process is demoted with the nice command. The nice command has been introduced in the previous section. In simple terms, the nice command changes the priority of the process.

%system indicates the percentage of CPU used by the kernel process

%iowait indicates the percentage of CPU time that is used to wait for I/O

%IRQ indicates the percentage of CPU used to process system interrupts

%soft indicates the percentage of CPU used for software interrupts

%idle Show CPU idle time

%INTR/S shows the total number of interrupts received per second CPU

When you have the Vmstat described earlier, you may want to know what the Mpstat command does. The difference is great: Mpstat can display statistics for each processor,
Instead, Vmstat displays statistics for all processors. Therefore, writing bad applications (without using multithreaded architectures) may run on a multiprocessor machine,
Instead of using all processors. This causes one CPU to overload while the other CPUs are idle. These types of problems can be easily diagnosed with mpstat.

Usage for Oracle users
Similar to Vmstat, the Mpstat command also generates CPU-related statistics, so all discussions about CPU issues apply to Mpstat.
When you see a lower%idle number, you know that there is a problem with a low CPU. When you see a higher%iowait number,
You know that there are some problems with the I/O subsystem under the current load. This information is very convenient for troubleshooting Oracle database performance issues.

Comprehensive reference: Http://man.linuxde.net/mpstat

Linux Mpstat commands

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.