mpstat最大的优势点是在统计信息的旁边显示时间,由此,你可以找出CPU使用率与时间的关系
用法
mpstat 1
Linux 5.10.60-amd64-desktop (yeqiang-PC) 2022年04月01日 _x86_64_ (6 CPU)
16时45分54秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
16时45分55秒 all 2.32 0.17 8.79 5.64 0.00 0.00 0.00 0.00 0.00 83.08
16时45分56秒 all 11.52 0.15 13.33 0.00 0.00 0.00 0.00 0.00 0.00 75.00
16时45分57秒 all 10.90 0.47 9.97 0.00 0.00 0.00 0.00 0.00 0.00 78.66
16时45分58秒 all 3.23 0.16 10.82 0.00 0.00 0.00 0.00 0.00 0.00 85.78
16时45分59秒 all 4.12 0.16 8.57 0.00 0.00 0.00 0.00 0.00 0.00 87.15
16时46分00秒 all 2.83 0.17 8.82 4.16 0.00 0.00 0.00 0.00 0.00 84.03
16时46分01秒 all 6.48 0.16 9.72 0.00 0.00 0.00 0.00 0.00 0.00 83.63
16时46分02秒 all 4.28 0.16 9.56 0.00 0.00 0.16 0.00 0.00 0.00 85.83
16时46分03秒 all 8.75 0.16 12.64 0.00 0.00 0.32 0.00 0.00 0.00 78.12
16时46分04秒 all 2.51 0.17 9.03 0.00 0.00 0.33 0.00 0.00 0.00 87.96
16时46分05秒 all 1.66 0.17 9.44 4.14 0.00 0.00 0.00 0.00 0.00 84.60
列出所有核情况
mpstat -P ALL 1
Linux 5.10.60-amd64-desktop (yeqiang-PC) 2022年04月01日 _x86_64_ (6 CPU)
16时46分44秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
16时46分45秒 all 6.30 0.17 10.12 0.00 0.00 0.00 0.00 0.00 0.00 83.42
16时46分45秒 0 9.80 0.98 12.75 0.00 0.00 0.00 0.00 0.00 0.00 76.47
16时46分45秒 1 1.94 0.00 11.65 0.00 0.00 0.00 0.00 0.00 0.00 86.41
16时46分45秒 2 11.00 0.00 11.00 0.00 0.00 0.00 0.00 0.00 0.00 78.00
16时46分45秒 3 8.08 0.00 8.08 0.00 0.00 0.00 0.00 0.00 0.00 83.84
16时46分45秒 4 4.00 0.00 9.00 0.00 0.00 0.00 0.00 0.00 0.00 87.00
16时46分45秒 5 3.03 0.00 8.08 0.00 0.00 0.00 0.00 0.00 0.00 88.89
16时46分45秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
16时46分46秒 all 2.90 0.00 8.53 0.00 0.00 0.00 0.00 0.00 0.00 88.57
16时46分46秒 0 3.09 0.00 7.22 0.00 0.00 0.00 0.00 0.00 0.00 89.69
16时46分46秒 1 2.08 0.00 8.33 0.00 0.00 0.00 0.00 0.00 0.00 89.58
16时46分46秒 2 1.03 0.00 8.25 0.00 0.00 0.00 0.00 0.00 0.00 90.72
16时46分46秒 3 5.00 0.00 10.00 0.00 0.00 0.00 0.00 0.00 0.00 85.00
16时46分46秒 4 3.09 0.00 7.22 0.00 0.00 0.00 0.00 0.00 0.00 89.69
16时46分46秒 5 3.03 0.00 10.10 0.00 0.00 0.00 0.00 0.00 0.00 86.87
16时46分46秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
16时46分47秒 all 1.85 0.00 7.72 0.17 0.00 0.00 0.00 0.00 0.00 90.27
16时46分47秒 0 1.04 0.00 5.21 0.00 0.00 0.00 0.00 0.00 0.00 93.75
16时46分47秒 1 1.00 0.00 9.00 0.00 0.00 0.00 0.00 0.00 0.00 90.00
16时46分47秒 2 1.98 0.00 7.92 0.99 0.00 0.00 0.00 0.00 0.00 89.11
16时46分47秒 3 1.01 0.00 9.09 0.00 0.00 0.00 0.00 0.00 0.00 89.90
16时46分47秒 4 2.00 0.00 7.00 0.00 0.00 0.00 0.00 0.00 0.00 91.00
16时46分47秒 5 4.00 0.00 8.00 0.00 0.00 0.00 0.00 0.00 0.00 88.00
16时46分47秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
16时46分48秒 all 2.31 0.17 8.91 10.07 0.00 0.00 0.00 0.00 0.00 78.55
16时46分48秒 0 3.92 0.00 9.80 0.00 0.00 0.00 0.00 0.00 0.00 86.27
16时46分48秒 1 2.97 0.00 7.92 60.40 0.00 0.00 0.00 0.00 0.00 28.71
16时46分48秒 2 1.96 0.98 10.78 0.00 0.00 0.00 0.00 0.00 0.00 86.27
16时46分48秒 3 2.94 0.00 10.78 0.00 0.00 0.00 0.00 0.00 0.00 86.27
16时46分48秒 4 1.00 0.00 7.00 0.00 0.00 0.00 0.00 0.00 0.00 92.00
16时46分48秒 5 1.01 0.00 7.07 0.00 0.00 0.00 0.00 0.00 0.00 91.92