Red Hat Bugzilla – Bug 68158
top showing incorrect CPU usage
Last modified: 2007-04-18 12:43:56 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020625
Description of problem:
While compiling wine in one gome-terminal and listeding to MP3's with XMMS. I
ran top in another gnome-terminal.
In the top of TOP it shows high CPU usage, but all the running processes do not
add up to using anywhere near the show CPU usage.
The URL provided goes to a screenshot showing this.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
In this case, compile wine and run XMMS and a few other apps, then run top.
Your screenshot doesn't appear to have top sorted by CPU, so it is hard to tell.
At least glance it appears CPU sorted, but you have 0.0 cpu stuff before 0.1 cpu
stuff. Can you include a CPU sorted top and a longer list?
In the screenshot it looks like it's in the middle of updating the display, so
that is why it's not looking sorted.
Collecting these kinds of data are kind of racy though. Data is read from
several sources, and the state could change between reading the global stats and
the process list data. I'll take a look at what could be happening.
Right, the screenshot was while it was being updated. The list was definatley
being sorted by CPU usage.
I watched top for about 10 mintures trying to figure out where all the CPU was
I will recreate this later in the day, and try to get a better screenshot.
I know what's happening. You're compiling while running top, and the compilation
starts several shortlived processes that use lots of cpu. These all show up in
the CPU status field, because it looks at how many system-wide ticks were used up.
The stuff in the list only shows the currently running processes though, and if
the top refresh rate is long, a lot of processes that used time in between the
updates have died. Say everyone but the last compilation finished, and the last
compilation only has run for 1 second. The calculated %CPU for that compilation
is then 1/5 == 20% (5 sec is the default delay). The rest of the CPU using
processes are not in the list, because they already died.