TOP shows above 100% WCPU usage

Brent Casavant b.j.casavant at ieee.org
Thu Aug 17 17:11:45 UTC 2006


On Thu, 17 Aug 2006, Chuck Swiger wrote:

> On Aug 16, 2006, at 10:28 PM, Bill LeFebvre wrote:
> > > > You have multiple CPUs, so a threaded process can theoretically reach
> > > > 100*ncpus cpu usage.
> > > > 
> > > Ahh, thats makes sense, thanks.
> > 
> > Actually it doesn't.  IMO, %CPU should be biased for all available cpu, not
> > just a single cpu.  In other words, a single-threaded process running on a
> > two processor box should never see more than 50% cpu.  That's how top
> > computes it for SunOS.  But for freebsd top only displays whats in the proc
> > structure and I don't know off-hand how the kernel records it.
> 
> You've got a good point here.  In particular, consider the case where you have
> an SMP machine where not all of the CPUs are running at the same clock
> rate...100% of one CPU is not the same level of processing as 100% of another.

Note that IRIX's top does not bias for availabile CPUs -- I've seen
well-threaded programs using in excess of 2400% CPU.

What it comes down to is that depending on the nature of the information
you're trying to glean from WCPU, you may want either view of the data.
Some versions of top on Linux allow you to switch between IRIX and Solaris
views.  From the help screen for top from procps 3.2.6 on Linux:

  1,I       Toggle SMP view: '1' single/separate states; 'I' Irix/Solaris mode

There's really not a clear cut right and wrong here, particularly if
your version of top is able to display per-thread instead of per-process
data.  Sometimes you want to break out individual threads and see their
level of CPU utilization (the IRIX view is most useful), sometimes you want
to get a handle on which processes are loading down a machine (the Solaris
view is most useful).

Brent Casavant

-- 
Brent Casavant			Dance like everybody should be watching.
www.angeltread.org
KD5EMB, EN34lv


More information about the freebsd-stable mailing list