Revision of CPU load from Tue, 01/15/2008 - 09:30

One important thing to check on your Linux box, is the CPU utilization, specially if usually compile software, or if you have server applications running on your PC.

One good tool to check this is: htop, which will show you a lot of useful information, the important data is the load average, that will show you if you are having processes waiting for the CPU or not.

the three numbers shows your the load average in the last 1 minute, 5 minutes and 15 minutes, so you will also see the trend of the CPU usage, and now how much is good and how much is overloaded?

Well it depends on how many CPUs your system have, one good explanation I have found about at: Linux Journal says:

The point of perfect utilization, meaning that the CPUs are always busy and, yet, no process ever waits for one, is the average matching the number of CPUs. If there are four CPUs on a machine and the reported one-minute load average is 4.00, the machine has been utilizing its processors perfectly for the last 60 seconds. This understanding can be extrapolated to the 5- and 15-minute averages.

Another important data shown here is the CPU percentage, which shows you the percentage of time your CPU was utilized by a process, if you need more detailed information, you can use: mpstat, to use this command you will have to install sysstat

apt-get install sysstat

or, if using Fedora or Centos

yum install sysstat

then you just need to run

mpstat

the output will be something like this:

01:06:46 AM  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
01:06:46 AM  all    8.87    0.07   29.37    7.40    0.39    0.03    0.00   53.87   1523.97

If the command is given like this, with no parameters, it will shows you the percentages since the boot of the machine, read the mpstat man page for more details.

mpstat Focus on the CPU percentage and not on the CPU load average, if you want a tool that focus on that use: uptime and you will see something like this:

 01:16:19 up  3:09,  4 users,  load average: 0.69, 0.53, 0.42

You can always use top, to have all this and more information on the screen and on real time.