The following 1 line script prints the processes which are using CPU most of the time:
$ top -d 3600 -n 24 | awk '{arr[$13] += $10} END { for (x in arr) print x" \t"arr[x]; }' | sort -r -n -k2 > daily_stats
You can vary value of -d ---- and -n -- of top, to increase accuracy of
statistics. i.e. (delay) * (count) should be 86400 always for daily
statistics.
for example:
$ top -d 1800 -n 48 | awk '{arr[$13] += $10} END { for (x in arr) print x" \t"arr[x]; }' | sort -r -n -k2 > daily_stats
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment