How is CPU usage calculated?

Adam Vande More amvandemore at gmail.com
Mon Oct 18 20:35:57 UTC 2010


On Mon, Oct 18, 2010 at 3:06 PM, Martin Turgeon
<freebsd at optiksecurite.com>wrote:

> I just reread it and it isn't clearer what is using the CPU so much. Can
> you please give me a little more explanation?
>

A line in top(1) like:

CPU:  0.0% user,  0.0% nice,  0.4% system,  0.4% interrupt, 99.3% idle

does not describe how much CPU is being used, but rather a "percentage of
time spent in each of the processor states".  It's saying of the CPU cycles
that are being used, this is what it breaks down as.  Since MySQL is a
userland application, you'd expect the value of user to be quite high if
that was only thing running on your system and it was under high load.

You can infer how much CPU is being used from the line, but there are better
and more accurate methods generally of getting that information especially
with SMP systems.

-- 
Adam Vande More


More information about the freebsd-questions mailing list