![如何获取CPU核心负载百分比?](https://linux22.com/image/5219/%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96CPU%E6%A0%B8%E5%BF%83%E8%B4%9F%E8%BD%BD%E7%99%BE%E5%88%86%E6%AF%94%EF%BC%9F.png)
我想知道每个核心的 CPU 负载百分比。我执行top
然后按1
输出是这样的:
%Cpu0 : 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu1 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
- 每一列的含义是什么?
- % 栏在哪里?
- 我可以添加吗?
答案1
您可以添加除id
(idle)、wa
(io wait) 和st
(stolen) 之外的所有列来获取 CPU 负载。
您会在手册页中找到大多数列的含义top
:
us, user : time running un-niced user processes
sy, system : time running kernel processes
ni, nice : time running niced user processes
wa, IO-wait : time waiting for I/O completion
hi : time spent servicing hardware interrupts
si : time spent servicing software interrupts
st : time stolen from this vm by the hypervisor