I thought the average load by uptime and the summation of %CPU of all running processes in top (#9 column) should agree. But it seems not true. Here is my little experiments:
On one server:
$ top -b -n 1| awk '{ totuse = totuse + $9 } END { print totuse/100 }'; uptime
6.29
22:00:59 up 28 days, 7:03, 9 users, load average: 7.03, 5.81, 4.51`
On another server:
$ top -b -n 1| awk '{ totuse = totuse + $9 } END { print totuse/100 }'; uptime
4.93
22:01:37 up 29 days, 8:27, 17 users, load average: 18.83, 16.01, 13.86`
So why is there such a difference between the two? Which one more truly reflect the usage of CPUs?
If I try to evaluate how much CPU usage my running processes are using, is this a good way:
top -b -n 1 | grep "tim"| awk '{ totuse = totuse + $9 } END { print totuse/100 }'
?
Thanks and regards!