Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jun 2006 20:01:40 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Danial Thom <danial_thom@yahoo.com>
Cc:        freebsd-performance@freebsd.org, David Xu <davidxu@freebsd.org>
Subject:   Re: Initial 6.1 questions
Message-ID:  <20060613195113.T26068@fledge.watson.org>
In-Reply-To: <20060613184336.60229.qmail@web33314.mail.mud.yahoo.com>
References:  <20060613184336.60229.qmail@web33314.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, 13 Jun 2006, Danial Thom wrote:

>> Two types of measurements are taken: sampled ticks regarding whether the 
>> system as a while is in {user, nice, system, intr, idle}, and then sampling 
>> for individual processes.  Right now, the system measurements are kept in a 
>> simple array of tick counters called cp_time. John Baldwin and others have 
>> changes that make these tick counters per-CPU. The lines at the top of 
>> top(1)'s output are derived from those tick counters.  Ticks are measured 
>> on each CPU, so those are a summary across all CPUs.  To add cpustat 
>> support, we need to merge John's patch to make cp_time per-CPU (ie., 
>> different counters for different CPUs) and teach the userland tools to 
>> retrieve them.  When you run top you'll notice that it adjusts the 
>> measurements each refresh.  In effect, what it's doing is sampling the 
>> change in tick counts over the window, pulling down the new values and 
>> calculating the percentages of ticks in each "bucket" in the last window.
>
> That doesn't explain why the Top line shows 99.6% idle, but the cpu idle 
> threads are showing significant usage.
>
> I'm getting a constant 6000 Interrupts / Second on my em controller, yet top 
> jumps all over the place; sitting at 99% idle for 10 seconds, then jumping 
> to 50%, then somewhere in between. It seems completely unreliable. The load 
> I'm applying is constant.

I can't speak to the details of the thread/process use sampling model.  Top 
uses something called the "weighted cpu percentage" by default; you can switch 
to "unweighted" using the -C argument.  The top documentation fails to 
document the semantics of the percentages, but I suspect -C will give you more 
of what you expect.  The weighted CPU measurement takes into account process 
history, so it takes a while for sudden spike in CPU use to be fully 
reflected, and you may see seemingly counter-intuitive results, such as the 
appearance of greater than 100% CPU use.  Try out -C and see if you see 
something that makes more sense?

Robert N M Watson
Computer Laboratory
Universty of Cambridge



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060613195113.T26068>