Monitoring CPU usage
Quick way to track how much CPU is being used on your system:
$ mpstat -P ALL 1 1
Linux 3.13.0-44-generic (ub) 01/15/2015 _x86_64_ (8 CPU)
04:23:47 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
04:23:48 PM all 25.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 75.00
04:23:48 PM 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
04:23:48 PM 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
04:23:48 PM 2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
04:23:48 PM 3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
04:23:48 PM 4 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
04:23:48 PM 5 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
04:23:48 PM 6 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
04:23:48 PM 7 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
That’s a report with 2 processes spinning at 100% on an 8 CPU system. I usually use top and look at Munin graphs, but this is a bit more precise. Leave off the last “1” and it runs continuously, reporting once a second. Leave off both “1”s and it shows you the average since the system booted. Leave off the “-P ALL” and you get just the top line, an average over all CPUs.