load average 表示同一时间有多少任务等待 CPU 资源,而 cpu usage 表示 cpu 处理非空闲任务所花费的时间的百分比。
获取每个 CPU 使用情况:
cat /proc/stat |grep cpu |awk '{printf ("%5s usage %f\n", $1, 100-($5*100)/($2+$3+$4+$5+$6+$7+$8+$9+$10))}'
load average 表示同一时间有多少任务等待 CPU 资源,而 cpu usage 表示 cpu 处理非空闲任务所花费的时间的百分比。
获取每个 CPU 使用情况:
cat /proc/stat |grep cpu |awk '{printf ("%5s usage %f\n", $1, 100-($5*100)/($2+$3+$4+$5+$6+$7+$8+$9+$10))}'