From owner-freebsd-current@FreeBSD.ORG Mon Nov 29 20:07:16 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CD3ED16A4ED for ; Mon, 29 Nov 2004 20:07:16 +0000 (GMT) Received: from mail.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id A52BA43D62 for ; Mon, 29 Nov 2004 20:07:16 +0000 (GMT) (envelope-from julian@elischer.org) Received: from elischer.org (julian.vicor-nb.com [208.206.78.97]) by mail.vicor-nb.com (Postfix) with ESMTP id 3CFB87A403; Mon, 29 Nov 2004 12:07:16 -0800 (PST) Message-ID: <41AB8174.4090205@elischer.org> Date: Mon, 29 Nov 2004 12:07:16 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030516 X-Accept-Language: en, hu MIME-Version: 1.0 To: Dan Nelson References: <20041128233704.GB62951@NitroPhys.welchsmnet.net> <20041129154805.GD5518@dan.emsphone.com> In-Reply-To: <20041129154805.GD5518@dan.emsphone.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org cc: Sean Welch Subject: Re: top under 5.3-RELEASE X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2004 20:07:17 -0000 Dan Nelson wrote: >In the last episode (Nov 28), Sean Welch said: > > >>Through 5.2.1-RELEASE I've been accustomed to seeing the top few >>processes using a % of cpu that correspondes to the % free cpu value >>in the header part of the output. Ie, if the machine is 20% idle I >>expect to see the process %s to add up to roughly 80%. This seems no >>longer to be the case under 5.3-RELEASE and I'm rather confused by a >>0% idle statement with the process %s adding up to only about 15% or >>so. >> >>The amount jumps around a bit and seems to bear the relationship I >>expect when there is light load, but it looks completely wrong to me >>when there is heavy load (as in compiling a port). >> >>Can anyone explain this seeming inconsistency to me? >> >> > >For things like port builds, you end up with a lot of very short-lived >processes (sh, sed, cc, etc). Those either don't show up in top at all >becuase they have started and exited between the sampling intervals, or >else have not accumulated enough CPU time to register any %CPU (which >is a weighted average over time). > >The values should total up better when you have processes that hang >around a bit more. There was a regression in 5.3's libpthreads that >can make it report 0 CPU, so if you have some CPU-hungry threaded >programs, they may not show up in top at all even though they're using >100% cpu. libthr and libc_r report CPU correctly. > As background, libpthread assigns user threads to arbitrary kernel threads "as needed". The trouble is that if a user thread comes into the kernel, uses a kernel thread, and then exits the kernel and another user thread does the same, where can we store the info about the first thread? We have no place to store this info in libpthreads.. at least not in a form useful to 'top' and 'ps'.