3 #==============================================================================
8 # Description : print cpu percentage usage.
9 #==============================================================================
11 read cpu a b c previdle rest
< /proc
/stat
12 prevtotal
=$
((a
+b
+c
+previdle
))
14 read cpu a b c idle rest
< /proc
/stat
16 cpu
=$
((100*( (total-prevtotal
) - (idle-previdle
) ) / (total-prevtotal
) ))
19 # Get top 10 process usage
20 # ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10