cpu monitor: mpstat command

mpstat is MultiProcessor Statistics acronym is real-time system monitoring tools. Some statistics report CPU, the information stored in the / proc / stat file. Multi-CPUs in the system, it will not only be able to view status information for all the average CPU, but also be able to view information about a specific CPU.

grammar:

      mpstat [-P {|ALL}] [internal [count]]

parameter:

    (1) -P {| ALL} : indicates which monitor CPU, ranging in [0, cpu number -1] in;

    (2) internal: adjacent interval of two samples;

    (3) count: the number of sampling, count can only be used with delay;

      Note: When no parameters, mpstat the average of all the information after the system start-up display. When interval, the average information since the first line of information from system startup. Starting from the second row, the average information of the previous output period interval.

[root@node01 ~]# yum install sysstat -y

Example:

(1) All CPU of the information display: mpstat -P ALL 1 (interval 1s)

[root @ node01 ~] # mpstat -P ALL 1 
Linux 3.10 . 0 - 693 .el7.x86_64 (node01) 2020 March 17 _x86_64_ ( 1 the CPU) 

20 38 Miao Shi Fen 38 the CPU     % usr% Nice     % SYS % Soft IRQ iowait%%%% Guest Steal% gnice% IDLE 
20 is 39 when 38 is of 5 seconds All     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00   100.00 
20 is 39 when 38 is of 5 seconds     0     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00   100.00

20:38:39 the CPU     % usr% Nice     % SYS% iowait% IRQ% Soft% Steal% Guest% gnice% IDLE 
20 is when 38 is of 5 40 seconds All     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00   the 100.00 
20 is when 38 is of 5 40 seconds     0     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00   100.00 

20:38:40 the CPU     % usr% Nice     % SYS% iowait% IRQ% Soft% Steal% Guest% gnice% IDLE 
20 is when 38 is of 5 41 is seconds All     0.00     0.00     0.00     0.00     0.00    0.00     0.00     0.00     0.00   100.00 
20:38:41     0     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00   100.00 

20:38:41 the CPU     % usr% Nice     % SYS% iowait% IRQ% Soft% Steal% Guest% gnice% IDLE 
20 is 38 minutes 42 seconds All     0.00     0.00     0.99     0.00     0.00     0.00     0.00     0.00     0.00    99.01 
20 is 38 minutes and 42 seconds     0     0.00     0.00     0.99     0.00     0.00     0.00     0.00     0.00     0.00   99.01 

20:38:42 the CPU     % usr% Nice     % SYS% iowait% IRQ% Soft% Steal% Guest% gnice% IDLE 
20 is when 38 is minutes and 43 seconds All     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00   the 100.00 
20 is when 38 is minutes 43 sec     0     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00   100.00 

20:38:43 the CPU     % usr% Nice     % SYS% iowait% IRQ% Soft% Steal% Guest% gnice% IDLE 
20 is when 38 is of 5 44 is seconds All     0.00     0.00     0.00     0.00    0.00     0.00     0.00     0.00     0.00   100.00 
20:38:44     0     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00   100.00 

20:38:44 the CPU     % usr% Nice     % SYS% iowait% IRQ% Soft% Steal% Guest% gnice% IDLE 
20:38:45 All     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00   the 100.00 
20:38:45     0     0.00     0.00     0.00     0.00     0.00     0.00     0.00     0.00    0.00   100.00 

20:38:45 the CPU     % usr% Nice     % SYS% iowait% IRQ% Soft% Steal% Guest% gnice% IDLE 
20 is when 38 is of 5 46 is seconds All     0.00     0.00     1.00     0.00     0.00     0.00     0.00     0.00     0.00    99.00 
20 is when 38 is of 5 46 seconds     0     0.00     0.00     1.00     0.00     0.00     0.00     0.00     0.00     0.00    99.00 
^ C 

average time: the CPU     % usr% Nice     % SYS iowait%%% Soft IRQ Steal%%% gnice% Guest IDLE 
average time: All     0.00     0.00    0.25     0.00     0.00     0.00     0.00     0.00     0.00    99.75 
Average time:     0     0.00     0.00     0.25     0.00     0.00     0.00     0.00     0.00     0.00    99.75

2) the CPU displays ID information of 1: mpstat -P 1 1 (interval 1s)

Results show that:

(1) user: the internal time period, CPU time, the user state (%), does not contain a nice process is negative, the value (usr / total) * 100;

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

(. 3) System : the internal time period, the core time (%), a value (system / total) * 100;

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

(. 5) IRQ : the internal time period, a hard interruption time (%), the value (irq / total) * 100;

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

(. 7) IDLE : the internal time period, the CPU waits for any reason to remove free time outside the disk IO operations idle time (%), the value (idle / total) * 100;

(. 8) INTR / S : the internal time period, the number of CPU interrupts per second received value (intr / total) * 100;

It shows various statistics system CPU. -P ALL options directs the command displays statistics for all of the CPU, 
rather than just statistics for a specific CPU. Parameter 52 indicates the command 5 seconds run time, total run time every 2. 
More than the total output index shows first of all the CPU, and then displays the respective indicators for each CPU. Finally, the average of all displays at the end of the CPU. 

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

% represents the percentage of the User user process used by the CPU. User processes are non-kernel processes for applications (such as Oracle database). 
In the present example the output, the user CPU is very low percentage. 

% nice nice command process represents the percentage of CPU time to downgrade. In the previous section already nice command was introduced. In short, nice command to change the priority of the process. 

% system kernel processes represents percentage of CPU 

% iowait represents waiting for CPU time I / O is used percentage 

% irq showing a system for processing interrupt to the CPU percentage 

% soft represents a software interrupt to the CPU percentage 

% idle CPU idle display time 

% intr / s display the total number of CPU interrupts per second received 

when you have vmstat, described earlier, you may want to know the role mpstat command. Very different: mpstat can display statistics for each processor, 
and vmstat displays statistics for all processors. Therefore, poorly written application (do not use a multithreaded architecture) may be run on a multi-processor machine, 
Instead of using all processors. Resulting in a CPU overload, while the other CPU is very idle. You can easily diagnose these types of problems by mpstat. 

Usage for Oracle Users 
with similar vmstat, mpstat command also generates statistical information about the CPU, so all discussions related to the CPU issues applies to mpstat. 
When you see a low% idle figure, you know you have CPU starvation. When you see a higher% iowait numbers, 
you know that under the current load I / O subsystem certain problems. This information is very easy to solve Oracle database performance problems.

 

Guess you like

Origin www.cnblogs.com/liujunjun/p/12513231.html
Recommended