Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the mpstat command in linux

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to use the mpstat command in linux. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

1. Mpstat command

1.1 Command format

Mpstat [- A] [- u] [- V] [- I {SUM | CPU | SCPU | ALL}] [- P {cpu [,...] | ON | ALL}] [interval [count]]

OPTIONS:

-A: equivalent to-u-I ALL-P ALL

-I: you can specify four parameters of SUM CPU SCPU ALL. SUM represents the total number of interrupts per processor, CPU represents the number of interrupts per second per core, and SCPU represents the number of soft interrupts per second per core. Kernel version supports it after 2.6.31.

-P: statistical CPU number, usually using ALL

-u: output column information

-V: view the tool version number

two。 Use

2.1 output the usage of all cpu every 1s

$mpstat-P ALL 1Linux 3.10.0-693.el7.x86_64 (zhanghao) 26 February 2019 _ x86room642 CPU 12:42:03 CPU% usr% sys% iowait% irq% soft% steal% guest% gnice% idle12: 42: 04 all 0.00 0.00 0.00 100.0012: 42: 04: 00.00 0.00 0.00 0.00 100.0012: 42 minutes 04 seconds 1 0.00 0.00 0.00 100.0012 hours 42 minutes 04 seconds CPU% usr% sys% iowait% irq% steal% guest% gnice% idle12: 42 minutes 05 seconds all 0.00 0.00 0.00 0.00 0.00 0.00 100.0012: 42 minutes 05 seconds 00.00 0.00 0.00 0.00 100.0012: 42 minutes 05 seconds CPU% usr% sys% iowait% soft% steal% guest% gnice% idle12: 42 seconds 06 seconds all 0.00 0.00 0.00 0.50 0.00 0.00 0.00 99.5012: 42 06 seconds 00.00 0.00 0.00 0.00 100.0012: 42 06 seconds 1 0.00 0.00 0.00 12: 42 06 seconds CPU% usr% nice % sys% iowait% irq% soft% steal% guest% gnice% idle12: 42 07 seconds all 0.00 0.00 0.00 100.0012: 42 07 seconds 00.00 0.00 0.00 0.00. 00 0.00 0.00 100.0012: 42: 07 seconds CPU% usr% sys% iowait% irq% soft% steal% guest% gnice% idle12: 42: 08: all 0.00 0.00 0.00 100.0012: 42: 08: 00.00 0.00 0.00 0.00: 42min 08 1 0.00 0.00 0.00 100.00

Field analysis:

CPU: process id of each CPU

% usr: utilization of cpu in user mode

% nice: usage of CPU for users with nice priority

% sys: displays the percentage of CPU utilization that occurs when the kernel kernel state executes. This does not include the time spent maintaining hardware and software interrupts.

% iowait: displays the percentage of time that CPU or CPU is idle when the system has an outstanding disk Imax O request

% irq: percentage of time spent on hard interrupts served by the system

% soft: percentage of time spent on soft interrupt overhead served by the system

% steal: displays the percentage of time that the virtual CPU or CPU was forced to wait while the hypervisor was serving another virtual processor

% guest: time spent by CPU to process virtual processes

% idel:% CPU idle percentage

2.2 View soft interrupt statistics

$mpstat-I SCPU 1Linux 3.10.0-693.el7.x86_64 (zhanghao) February 26, 2019 _ x86room642 CPU 15:23:07 CPU HI/s TIMER/s NET_TX/s NET_RX/s BLOCK/s BLOCK_IOPOLL/s TASKLET/s SCHED/s HRTIMER/s RCU/s15 time 23: 08 seconds 0 0.00 5.00 0.00 0.00 0.00. 00 2.00 0.00 4.00 15: 23 08 seconds 1 0.00 28.00 0.00 5.00 0.00 0.00 24.00 3.00 15: 23 09 seconds 0.00 6.00 0.00 0.00 2.00 0.00 3.00 5.00 15: 23 09 seconds 1 0.00 26 .00 0.00 70.00 0.00 0.00 0.00 24.00 2.00 15: 23 minutes 10 seconds 0 0.00 16.00 0.00 0.00 0.00 12.00 3.00 15: 23 10 seconds 1 0.00 13.00 6.00 0.00 0.00 13.00 0.00 1.00 15: 23 11 seconds 0 0.00 18.00 0.00 0.00 2.00 0.00 0.00 14.00 3.00 15: 23 minutes 11 seconds 10.00 12.00 0.00 5.00 0.00 0.00 0.00 1.001 05:23:12 00.00 8.00. 00 0.00 0.00 0.00 4.00 3.00 15: 23 minutes 12 seconds 1 0.00 30.00 0.00 0.00 0.00 19.00 0.00 4.00 15: 23 minutes 13 seconds 0 0.00 7.00 0.00 0.00 0.00 3.00 0.00 3.0015: 23: 13 seconds 1 0.00 23.00 0.00 0.00 0.00 22.00 0.00 1.00 15: 23: 14 seconds 0.00 11.00 0.00 0.00 0.00 7.00 6.00 15: 23 14 seconds 1 0.00 30.00 0.00 12.00 1.00 0.00 0.00 25.00 0.00 8.00 15 minutes 15 seconds 0 0.00 9.00 0.00 0.00 0.00 6.00 15 minutes 15 seconds 1 0.00 31.00 0.00 7.00 0.00 0.00 24.00 5.0015: 23 Minutes 16 seconds 0 0.00 8.00 0.00 0.00 0.00 4.00 6.00 15: 23 16 seconds 10.00 25.00 0.00 6.00 0.00 0.00 0.00 22.00 3.00 15: 23 17 seconds 00.00 10.00 0.00 0.00 2.00 0.00 0.00 6.00 3.00 15: 23 minutes 17 seconds 1 0.00 24.00 0.00 7.00 0.00 0.00 23.00 0.00 1.00

2.3 output once every 2 seconds, output 3 times

$mpstat 2 3Linux 3.10.0-693.el7.x86_64 (zhanghao) February 27, 2019 _ x86room642 CPU 02:13:29 CPU% usr% nice% iowait% irq% soft% steal% guest% gnice% idle02: 31 seconds all 0.00 0.00 0.00 100.0002: 13 seconds all 0.00 0.00 0.00 0.00 0.00 100.0002: 13 minutes 35 seconds all 0.00 0.00 0.00 100.00 average time: all 0.00 0.00 0.00 100.00 what is the Linux system Linux is a free-to-use and free-spread UNIX-like operating system Is a POSIX-based multi-user, multi-tasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.

After reading the above, do you have any further understanding of how the mpstat command is used in linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report