[Sussex] processor usage as shown by top

Tony Austin tony at gigaday.com
Sun Aug 22 18:33:29 UTC 2004


> | If I look at top while running a compile I see in the heading line:
> |
> | Cpu(s):  97.0% user, 3.0%, system, 0.0% nice, 0.0% idle
> |
> | In the body at the top of the list I see cc1 using about 12.0% and
> nothing
> | much else reporting any processor usage.
> |
> | I would have expected the list of percentages to add up to roughly the
> | "user" figure.
> |
> | Can anyone explain what  these numbers mean?
>
> If you tell top to refresh more often, your cc1 will spend less time shown
> on the terminal, but will use more like 85% CPU or whatever. The reason (I
> think) is that the kernel reports the total user/sys/nice percentages,
> whereas top + co. have to work out the process specific ones themselves
> from 'CPU time used so far' figures. If top is only refreshing once every
> 2 seconds, and cc1 has been running 80 milliseconds so far when top
> refreshes, it will only have used a minute percentage of the CPU time in
> the last 2 seconds. All the rest was used by the previous incarnation of
> cc1 which finished when top wasn't looking.

Aah!   If I understand what you are saying it's this "Because it's a
kernel compile, I am looking at cc1 starting and stopping more often than
top's default delay time, which seems to be 3 seconds; so what I am seeing
is a little bit of each (different) cc1 process.  If on the other hand I
was running some monolithic process that continued as the same process for
many seconds, I would see more coherent figures."

I tried dropping the delay time and observed just what you predicted.

Thanks.

Tony

> That may be right at any rate - that's what I decided when I noticed a few
> months ago, but I never did bother to look it up.
>


Regards.

Tony Austin
Gigaday Computing Limited
http://www.gigaday.com
tony at gigaday.com





More information about the Sussex mailing list