ps -e -L h o state,cmd | awk '{if($1=="R"||$1=="D"){print $0}}' | sort | uniq -c | sort -k 1nr
2 CPU高、Load高情况分析
使用vmstat
查看系统纬度的 CPU 负载;
使用 top
查看进程纬度的 CPU 负载;
2.1 使用 vmstat 查看系统纬度的 CPU 负载
可以通过 vmstat 从系统维度查看 CPU 资源的使用情况
格式:vmstat -n 1 -n 1
表示结果一秒刷新一次
1 @VM-1-14-centos ~]# vmstat -n 1 2 -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- 3 swpd free buff cache si so bi bo in cs us sy id wa st 4 0 250304 163472 2154300 0 0 1 16 0 4 1 0 98 0 0 5 0 250412 163472 2154332 0 0 0 0 937 1439 1 1 99 0 0 6 0 250428 163472 2154332 0 0 0 4 980 1329 0 0 100 0 0 7 0 250444 163472 2154332 0 0 0 0 854 1227 0 0 99 0 0 8 0 250444 163472 2154332 0 0 0 68 832 1284 0 1 99 1 0 9 0 250016 163472 2154332 0 0 0 0 929 1389 1 1 99 0 0