Interpreting Top output

  • Follow


Hi all,

I get the following output with a TOP :

Cpu states:  1.6% user, 29.6% nice, 39.6% system, 29.0% idle
Memory: Real: 1007M/2566M act/tot  Virtual: 365M/14335M use/tot  Free:
43M

  PID USERNAME PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
19632 linus     44    2   54M   10M run   769:14 92.30% ppcscpg310_sep
 2540 linus     44    2  103M   13M sleep 315:28  7.30% snap
19531 linus     44    0   78M   59M sleep  31:13  3.60% sipsubsystem.e
19502 linus     44    2  416M  362M sleep  25:30  3.30% sinssfg310_sep
 3018 linus     46    2  161M 1794K sleep 378:05  3.20% oracle
 3002 linus     46    2  203M 1581K sleep 415:27  3.00% oracle
19596 linus     46    2  169M 1572K sleep  21:50  2.80% oracle
 1122 linus     42    2   16M 1269K sleep  14:29  2.70% trunclog
 4313 linus     44    0 3272K 1032K run     0:01  2.10% top
 2836 linus     44    2   78M 3530K run   216:08  1.70% snap
 2782 linus     46    2  161M 1703K sleep  70:07  1.60% oracle
 2433 root      44    2   54M 5619K sleep 241:18  1.20% pfmalarm_sep
 1198 root      44    2   71M 2629K sleep  89:01  1.00% pfmconfig_sep
 2227 linus     42    2   55M 6488K sleep   8:37  0.90% pfmstat_sep
  965 linus     44    2   70M 2949K sleep  48:23  0.60% DpeRouter

I'm wondering :

- Why is the sum of individual processes CPU time percentages superior
to 100% ?
- Why do I have 1.6% user in CPU states whereas one of my process
takes 92.3 % of the CPU ?

My platform is Digital UNIX V4.0F (TRU64 Unix).

Thanks for help
0
Reply eric_entressangle 1/27/2004 8:40:58 AM

On 2004-01-27, Eric Entressangle <eric_entressangle@yahoo.fr> wrote:
> Hi all,
>
> I get the following output with a TOP :
>
> Cpu states:  1.6% user, 29.6% nice, 39.6% system, 29.0% idle
> Memory: Real: 1007M/2566M act/tot  Virtual: 365M/14335M use/tot  Free:
> 43M
>
>   PID USERNAME PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
> 19632 linus     44    2   54M   10M run   769:14 92.30% ppcscpg310_sep
>  2540 linus     44    2  103M   13M sleep 315:28  7.30% snap
> 19531 linus     44    0   78M   59M sleep  31:13  3.60% sipsubsystem.e
> 19502 linus     44    2  416M  362M sleep  25:30  3.30% sinssfg310_sep
>  3018 linus     46    2  161M 1794K sleep 378:05  3.20% oracle
>  3002 linus     46    2  203M 1581K sleep 415:27  3.00% oracle
> 19596 linus     46    2  169M 1572K sleep  21:50  2.80% oracle
>  1122 linus     42    2   16M 1269K sleep  14:29  2.70% trunclog
>  4313 linus     44    0 3272K 1032K run     0:01  2.10% top
>  2836 linus     44    2   78M 3530K run   216:08  1.70% snap
>  2782 linus     46    2  161M 1703K sleep  70:07  1.60% oracle
>  2433 root      44    2   54M 5619K sleep 241:18  1.20% pfmalarm_sep
>  1198 root      44    2   71M 2629K sleep  89:01  1.00% pfmconfig_sep
>  2227 linus     42    2   55M 6488K sleep   8:37  0.90% pfmstat_sep
>   965 linus     44    2   70M 2949K sleep  48:23  0.60% DpeRouter
>
> I'm wondering :
>
> - Why is the sum of individual processes CPU time percentages superior
> to 100% ?
> - Why do I have 1.6% user in CPU states whereas one of my process
> takes 92.3 % of the CPU ?

I can't answer the first question. I always considered these numbers as
relative usage level, and never tried to sum them. Read man top, there
shall be explanation for %CPU in it.

As to why your process takes 92.3%... Usually it means that your process
does heavy mathematics or got stuck in endless loop :) Only in this case
scheduler has to force your process to stop and give it control as soon
as it can. Most of regular processes wait for some event most of the
time (like arrival of packet from the network, or user input, or
response from disk etc.) so scheduler does not give control to them
untill that event arrives.

Andrei
0
Reply Andrei 1/28/2004 9:34:34 AM


Andrei Voropaev <avorop@mail.ru> wrote in message news:<bv7vn9$oqtae$1@ID-205467.news.uni-berlin.de>...
> On 2004-01-27, Eric Entressangle <eric_entressangle@yahoo.fr> wrote:
> > Hi all,
> >
> > I get the following output with a TOP :
> >
> > Cpu states:  1.6% user, 29.6% nice, 39.6% system, 29.0% idle
> > Memory: Real: 1007M/2566M act/tot  Virtual: 365M/14335M use/tot  Free:
> > 43M
> >
> >   PID USERNAME PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
> > 19632 linus     44    2   54M   10M run   769:14 92.30% ppcscpg310_sep
> >  2540 linus     44    2  103M   13M sleep 315:28  7.30% snap
> > 19531 linus     44    0   78M   59M sleep  31:13  3.60% sipsubsystem.e
> > 19502 linus     44    2  416M  362M sleep  25:30  3.30% sinssfg310_sep
> >  3018 linus     46    2  161M 1794K sleep 378:05  3.20% oracle
> >  3002 linus     46    2  203M 1581K sleep 415:27  3.00% oracle
> > 19596 linus     46    2  169M 1572K sleep  21:50  2.80% oracle
> >  1122 linus     42    2   16M 1269K sleep  14:29  2.70% trunclog
> >  4313 linus     44    0 3272K 1032K run     0:01  2.10% top
> >  2836 linus     44    2   78M 3530K run   216:08  1.70% snap
> >  2782 linus     46    2  161M 1703K sleep  70:07  1.60% oracle
> >  2433 root      44    2   54M 5619K sleep 241:18  1.20% pfmalarm_sep
> >  1198 root      44    2   71M 2629K sleep  89:01  1.00% pfmconfig_sep
> >  2227 linus     42    2   55M 6488K sleep   8:37  0.90% pfmstat_sep
> >   965 linus     44    2   70M 2949K sleep  48:23  0.60% DpeRouter
> >
> > I'm wondering :
> >
> > - Why is the sum of individual processes CPU time percentages superior
> > to 100% ?
> > - Why do I have 1.6% user in CPU states whereas one of my process
> > takes 92.3 % of the CPU ?
> 
> I can't answer the first question. I always considered these numbers as
> relative usage level, and never tried to sum them. Read man top, there
> shall be explanation for %CPU in it.
> 
> As to why your process takes 92.3%... Usually it means that your process
> does heavy mathematics or got stuck in endless loop :) Only in this case
> scheduler has to force your process to stop and give it control as soon
> as it can. Most of regular processes wait for some event most of the
> time (like arrival of packet from the network, or user input, or
> response from disk etc.) so scheduler does not give control to them
> untill that event arrives.
> 
> Andrei

Thanks for your help.
The Top manual is not so clear on CPU percentage. Here is what I got
from searches on the web :

"%CPU 
The task's share of the CPU time since the last screen update,
expressed as a percentage of total CPU time.
"

or again

"The percentage of CPU cycles consumed during the interval on behalf
of this process (both kernel and user space)."

This is why I don't understand why the sum of %CPU of all processes
exceeds 100%.

Concerning the second point, it is not so much the fact that the
process eats 92% of CPU that strikes me, but the 1.6% user indicated
by the first TOP�line.
Would it mean that my process eats 92% of the 1.6% CPU user ?
0
Reply eric_entressangle 1/28/2004 4:26:54 PM

In article <99aeb50d.0401280826.7a6c49aa@posting.google.com>,
 eric_entressangle@yahoo.fr (Eric Entressangle) wrote:

> Concerning the second point, it is not so much the fact that the
> process eats 92% of CPU that strikes me, but the 1.6% user indicated
> by the first TOP�line.
> Would it mean that my process eats 92% of the 1.6% CPU user ?

It's actually the other way around.  Of the 92% of the time that the 
process was using the CPU, about 1.6% of it was spent in user mode.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
0
Reply Barry 1/29/2004 3:45:06 AM

On 2004-01-28, Eric Entressangle <eric_entressangle@yahoo.fr> wrote:
> Andrei Voropaev <avorop@mail.ru> wrote in message news:<bv7vn9$oqtae$1@ID-205467.news.uni-berlin.de>...
>> On 2004-01-27, Eric Entressangle <eric_entressangle@yahoo.fr> wrote:
>> > Hi all,
>> >
>> > I get the following output with a TOP :
>> >
>> > Cpu states:  1.6% user, 29.6% nice, 39.6% system, 29.0% idle
>> > Memory: Real: 1007M/2566M act/tot  Virtual: 365M/14335M use/tot  Free:
>> > 43M
>> >
>> >   PID USERNAME PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
>> > 19632 linus     44    2   54M   10M run   769:14 92.30% ppcscpg310_sep
[...]
> Concerning the second point, it is not so much the fact that the
> process eats 92% of CPU that strikes me, but the 1.6% user indicated
> by the first TOP�line.
> Would it mean that my process eats 92% of the 1.6% CPU user ?

I'm not the authority in this question. But here's how I interpreted
this. The top line provides
statistics on general CPU usage in the system. "1.6% user" means that
processor was used for user space 1.6% of time. Specific applications
may run both in user mode (when they execute their own code) and in
system mode (when they make system calls). I would expect that your 92%
are part of both system and user share (1.6 + 39.6). Well, usually
system never does long operations on behave of user, so really these 92%
come mostly from 1.6% of time given to user space.

Why would you care so much about details in top output? Usually it is
used to see relative values, not absolute ones. If you are curious then
you may find sources for top and study them :)

Andrei
0
Reply Andrei 1/29/2004 11:26:34 AM

On 2004-01-29, Andrei Voropaev <avorop@mail.ru> wrote:
> On 2004-01-28, Eric Entressangle <eric_entressangle@yahoo.fr> wrote:
>> Andrei Voropaev <avorop@mail.ru> wrote in message news:<bv7vn9$oqtae$1@ID-205467.news.uni-berlin.de>...
>>> On 2004-01-27, Eric Entressangle <eric_entressangle@yahoo.fr> wrote:
>>> > Hi all,
>>> >
>>> > I get the following output with a TOP :
>>> >
>>> > Cpu states:  1.6% user, 29.6% nice, 39.6% system, 29.0% idle
>>> > Memory: Real: 1007M/2566M act/tot  Virtual: 365M/14335M use/tot  Free:
>>> > 43M
>>> >
>>> >   PID USERNAME PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
>>> > 19632 linus     44    2   54M   10M run   769:14 92.30% ppcscpg310_sep
> [...]
>> Concerning the second point, it is not so much the fact that the
>> process eats 92% of CPU that strikes me, but the 1.6% user indicated
>> by the first TOP�line.
>> Would it mean that my process eats 92% of the 1.6% CPU user ?
>
> I'm not the authority in this question. But here's how I interpreted
> this. The top line provides
> statistics on general CPU usage in the system. "1.6% user" means that
> processor was used for user space 1.6% of time. Specific applications
> may run both in user mode (when they execute their own code) and in
> system mode (when they make system calls). I would expect that your 92%
> are part of both system and user share (1.6 + 39.6). Well, usually
> system never does long operations on behave of user, so really these 92%
> come mostly from 1.6% of time given to user space.
>
> Why would you care so much about details in top output? Usually it is
> used to see relative values, not absolute ones. If you are curious then
> you may find sources for top and study them :)

Actually, I've read man top one more time and finally noticed there
words cputime and real time. Maybe your problems come from the fact that
cputime is not mesuared as wall clock time but in some other values? In
this case cputime/realtime relation is not perfect, meaning that sums of
cputimes for all processes does not need to be equal to wall clock time
and result sum of percentages won't be 100.

Andrei
0
Reply Andrei 1/29/2004 11:41:25 AM

Barry Margolin <barmar@alum.mit.edu> wrote in message news:<barmar-DE39BC.22450528012004@netnews.comcast.net>...
> In article <99aeb50d.0401280826.7a6c49aa@posting.google.com>,
>  eric_entressangle@yahoo.fr (Eric Entressangle) wrote:
> 
> > Concerning the second point, it is not so much the fact that the
> > process eats 92% of CPU that strikes me, but the 1.6% user indicated
> > by the first TOP�line.
> > Would it mean that my process eats 92% of the 1.6% CPU user ?
> 
> It's actually the other way around.  Of the 92% of the time that the 
> process was using the CPU, about 1.6% of it was spent in user mode.

It is strange that this "1.6% user" applies only to one process. I'd
rather say that it applies to all processes running, doesn't it ?
Maybe you meant that as this process almost eats all CPU, the other
ones can be ignored ?

For my first point, I noticed that the sum of %CPU of individual
processes is never equal to 100%.
0
Reply eric_entressangle 1/29/2004 2:10:17 PM

In article <99aeb50d.0401290610.3354ce9@posting.google.com>,
 eric_entressangle@yahoo.fr (Eric Entressangle) wrote:

> Barry Margolin <barmar@alum.mit.edu> wrote in message 
> news:<barmar-DE39BC.22450528012004@netnews.comcast.net>...
> > In article <99aeb50d.0401280826.7a6c49aa@posting.google.com>,
> >  eric_entressangle@yahoo.fr (Eric Entressangle) wrote:
> > 
> > > Concerning the second point, it is not so much the fact that the
> > > process eats 92% of CPU that strikes me, but the 1.6% user indicated
> > > by the first TOP�line.
> > > Would it mean that my process eats 92% of the 1.6% CPU user ?
> > 
> > It's actually the other way around.  Of the 92% of the time that the 
> > process was using the CPU, about 1.6% of it was spent in user mode.
> 
> It is strange that this "1.6% user" applies only to one process. I'd
> rather say that it applies to all processes running, doesn't it ?
> Maybe you meant that as this process almost eats all CPU, the other
> ones can be ignored ?

Yes, that was what I meant.  That's why I said "about".

> For my first point, I noticed that the sum of %CPU of individual
> processes is never equal to 100%.

I think this may be due to the fact that the percentages are actually 
time-decayed weighted.  It's not just the percentage during the previous 
10 seconds, it also includes previous segments, but with less weighting.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
0
Reply Barry 1/29/2004 2:45:46 PM


Eric Entressangle wrote:
> Andrei Voropaev <avorop@mail.ru> wrote in message news:<bv7vn9$oqtae$1@=
ID-205467.news.uni-berlin.de>...
>=20
>>On 2004-01-27, Eric Entressangle <eric_entressangle@yahoo.fr> wrote:
>>
>>>Hi all,
>>>
>>>I get the following output with a TOP :
>>>
>>>Cpu states:  1.6% user, 29.6% nice, 39.6% system, 29.0% idle
>>>Memory: Real: 1007M/2566M act/tot  Virtual: 365M/14335M use/tot  Free:=

>>>43M
>>>
>>>  PID USERNAME PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
>>>19632 linus     44    2   54M   10M run   769:14 92.30% ppcscpg310_sep=

>>> 2540 linus     44    2  103M   13M sleep 315:28  7.30% snap
>>>19531 linus     44    0   78M   59M sleep  31:13  3.60% sipsubsystem.e=

>>>19502 linus     44    2  416M  362M sleep  25:30  3.30% sinssfg310_sep=

>>> 3018 linus     46    2  161M 1794K sleep 378:05  3.20% oracle
>>> 3002 linus     46    2  203M 1581K sleep 415:27  3.00% oracle
>>>19596 linus     46    2  169M 1572K sleep  21:50  2.80% oracle
>>> 1122 linus     42    2   16M 1269K sleep  14:29  2.70% trunclog
>>> 4313 linus     44    0 3272K 1032K run     0:01  2.10% top
>>> 2836 linus     44    2   78M 3530K run   216:08  1.70% snap
>>> 2782 linus     46    2  161M 1703K sleep  70:07  1.60% oracle
>>> 2433 root      44    2   54M 5619K sleep 241:18  1.20% pfmalarm_sep
>>> 1198 root      44    2   71M 2629K sleep  89:01  1.00% pfmconfig_sep
>>> 2227 linus     42    2   55M 6488K sleep   8:37  0.90% pfmstat_sep
>>>  965 linus     44    2   70M 2949K sleep  48:23  0.60% DpeRouter
>>>
>>>I'm wondering :
>>>
>>>- Why is the sum of individual processes CPU time percentages superior=

>>>to 100% ?
>>>- Why do I have 1.6% user in CPU states whereas one of my process
>>>takes 92.3 % of the CPU ?
>>
>>I can't answer the first question. I always considered these numbers as=

>>relative usage level, and never tried to sum them. Read man top, there
>>shall be explanation for %CPU in it.
>>
>>As to why your process takes 92.3%... Usually it means that your proces=
s
>>does heavy mathematics or got stuck in endless loop :) Only in this cas=
e
>>scheduler has to force your process to stop and give it control as soon=

>>as it can. Most of regular processes wait for some event most of the
>>time (like arrival of packet from the network, or user input, or
>>response from disk etc.) so scheduler does not give control to them
>>untill that event arrives.
>>
>>Andrei
>=20
>=20
> Thanks for your help.
> The Top manual is not so clear on CPU percentage. Here is what I got
> from searches on the web :
>=20
> "%CPU=20
> The task's share of the CPU time since the last screen update,
> expressed as a percentage of total CPU time.
> "
>=20
> or again
>=20
> "The percentage of CPU cycles consumed during the interval on behalf
> of this process (both kernel and user space)."
>=20
> This is why I don't understand why the sum of %CPU of all processes
> exceeds 100%.
>=20
> Concerning the second point, it is not so much the fact that the
> process eats 92% of CPU that strikes me, but the 1.6% user indicated
> by the first TOP=A8line.
> Would it mean that my process eats 92% of the 1.6% CPU user ?

I would presume that you are running on a multi-cpu system and
TOP is reporting the percentage of a single CPU being used
by THAT particular process.  I would guess that this is a 4 CPU
system.

Regarding the question about pct usr, pct sys, etc.  those are
reported on a system-wide basis and do add up to 100%.
The indication that pct-usr is very low, while the CPU for one
particular process means that the process is calling upon the
OS to do a lot of it's work for it.  Every time you do a
system call (e.g. read, write, open, close, getpid, getuid, etc.),
control is transferred to the kernel to do that work on behalf
of the user process.  It does not indicate a compute-bound
process doing heavy arithmetic, since that is done in user space.
Having that kind of disparity between usr and system time is usually an=20
indication of some system call, or some library routine which
uses a system call within it, being called in a tight loop
without any other processing going on between calls, e.g.
calling time(2), or gettimeofday() (not sure if spelling is
correct), waiting for an appropriate time to do something
to be returned, rather than setting some timeout value,
or issuing a non-blocking read in the same tight loop only
to have he read return zero.



--=20
"It is impossible to make anything foolproof because fools are so=20
ingenious" - A. Bloch

0
Reply Nick 2/1/2004 12:50:31 AM

Correction to typos --- sorry!


Nick Landsberg wrote:

>=20
> Regarding the question about pct usr, pct sys, etc.  those are
> reported on a system-wide basis and do add up to 100%.
> The indication that pct-usr is very low, while the CPU for one
> particular process means that the process is calling upon the
> OS to do a lot of it's work for it.  Every time you do a
> system call (e.g. read, write, open, close, getpid, getuid, etc.),
> control is transferred to the kernel to do that work on behalf
> of the user process.  It does not indicate a compute-bound
> process doing heavy arithmetic, since that is done in user space.
> Having that kind of disparity between usr and system time is usually an=
=20
> indication of some system call, or some library routine which
> uses a system call within it, being called in a tight loop
> without any other processing going on between calls, e.g.
> calling time(2), or gettimeofday() (not sure if spelling is
> correct), ***NOT*** waiting for an appropriate time to do something
> to be returned, rather than setting some timeout value,
> or issuing a non-blocking read in the same tight loop only
> to have he read return zero.
>=20
>=20
>=20

--=20
=D1
"It is impossible to make anything foolproof because fools are so=20
ingenious" - A. Bloch

0
Reply Nick 2/1/2004 1:11:17 AM

9 Replies
362 Views

(page loaded in 0.122 seconds)

Similiar Articles:













7/24/2012 6:46:13 PM


Reply: