Bug 68158

Summary: top showing incorrect CPU usage
Product: [Retired] Red Hat Public Beta Reporter: Dan de Haan <zeron>
Component: procpsAssignee: Alexander Larsson <alexl>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: limbo   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
URL: http://gateway.dehaan.dhs.org/~dan/Screenshot.png
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-07-08 16:22:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 67218    

Description Dan de Haan 2002-07-07 06:40:30 UTC
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):


How reproducible:
Always

Steps to Reproduce:
In this case, compile wine and run XMMS and a few other apps, then run top.

Comment 1 Nathan G. Grennan 2002-07-07 22:30:23 UTC
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?

Comment 2 Alexander Larsson 2002-07-08 15:04:49 UTC
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.


Comment 3 Dan de Haan 2002-07-08 16:22:27 UTC
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
going to.

I will recreate this later in the day, and try to get a better screenshot.

Comment 4 Alexander Larsson 2002-07-09 15:17:24 UTC
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.