[Gllug] finding which process is causing high system load

Daniel P. Berrange dan at berrange.com
Thu Nov 24 10:25:38 UTC 2005


On Wed, Nov 23, 2005 at 11:10:46PM +0000, Ben Fitzgerald wrote:
> Hi,
> 
> I have a linux box where the cpu load is high, but this is due to a
> constant 80% spent (according to vmstat) in kernel code.
> 
> If I use top I can sort by %CPU but this only takes into account user
> mode time. If I sort by TIME+ I can see that the process hal is taking
> up hours of CPU time (so this field must sum up kernel and user time).
> 
> So, I can identify the process, but what if this hadn't been running for
> a long time. How can I display a list of processes sorted by % time spent
> in user mode + time spent in kernel mode on behalf of the process?

Two things, first I've known many versions of top to be basically
screwed at reporting CPU time, particularly when threads are involved.
eg, there are several versions that, hide child threads from display, but
fails to account for the time consumed by these hidden child threads
in the thread leader. There's some keystroke to make it display all
threads which may reveal what's going on.  The other possiblitiy is
you have some really short lived process which is doing alot of work,
and repeatedly exiting & respawning - and thus probably not being
caught by top. For finding such a beast, run OProfile for 5-10 minutes.
This can give you a report of CPU time broken down by binary, rather
than PID & is exceedingly accurrate compared to top, since it uses
hardware CPU counters & non-maskable interrupts for consistent sampling.

Dan.
-- 
|=-            GPG key: http://www.berrange.com/~dan/gpgkey.txt       -=|
|=-       Perl modules: http://search.cpan.org/~danberr/              -=|
|=-           Projects: http://freshmeat.net/~danielpb/               -=|
|=-   berrange at redhat.com  -  Daniel Berrange  -  dan at berrange.com    -=|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20051124/663a7055/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list