From owner-freebsd-questions@FreeBSD.ORG Thu Sep 14 14:20:26 2006 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C064E16A403; Thu, 14 Sep 2006 14:20:26 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id E503543D5A; Thu, 14 Sep 2006 14:20:24 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.6/8.13.6) id k8EEKOED080487; Thu, 14 Sep 2006 09:20:24 -0500 (CDT) (envelope-from dan) Date: Thu, 14 Sep 2006 09:20:24 -0500 From: Dan Nelson To: Ian Smith Message-ID: <20060914142023.GB91336@dan.emsphone.com> References: <20060914054758.GA77575@gothmog.pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 6.1-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.13 (2006-08-11) Cc: questions@freebsd.org, "Tamouh H." , Giorgos Keramidas Subject: Re: Top not showing cpu usage even remotely accurately X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2006 14:20:26 -0000 In the last episode (Sep 14), Ian Smith said: > I still can't fathom what top tells me on a UP 5.5-STABLE system (300MHz > Celeron if speed's relevant). I initiated this thread (weeks ago :) re > seeing 0.0% idle (as expected) during buildworld but not seeing anything > add up to anything like 100%, including S)ystem processes, in top. [..]> > However that doesn't explain this typical top view when the system is > quiescent or nearly so, as it mostly is, with only 5-minutely crons and > 11-minutely entropy runs and the odd sendmail to be seen in lastcomm: > > last pid: 18500; load averages: 0.01, 0.08, 0.06 up 5+08:40:33 17:30:30 > 136 processes: 3 running, 110 sleeping, 23 waiting > CPU states: 5.7% user, 0.0% nice, 6.3% system, 0.0% interrupt, 88.0% idle > Mem: 73M Active, 18M Inact, 46M Wired, 8108K Cache, 25M Buf, 2572K Free > Swap: 384M Total, 106M Used, 278M Free, 27% Inuse > > PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND > 11 root 171 52 0K 8K RUN 102.3H 86.82% 86.82% idle > 743 smithi 96 0 26616K 2908K select 156:40 1.03% 1.03% kdeinit > 708 smithi 96 0 34140K 15024K select 223:05 0.63% 0.63% Xorg > 644 root 96 0 1244K 244K select 30:19 0.05% 0.05% moused > 775 smithi 20 0 11524K 1028K kserel 319:17 0.00% 0.00% xmms > It never shows more than about 90% idle, whereas a 0.01 shorter term > load average should indicate more like 99% idle, shouldn't it? 97-99%, > sometimes 100% idle was what FreeBSD 4.5-R used to tell me with the same > workload in around the same memory use, but maybe 4.5 was optimistic .. I would guess that maybe xmms (or some other threaded app) is your hidden CPU consumer. The kernel does not calculate %CPU correctly for libkse-threaded programs, and they usually show up as 0% all the time. The TIME column does update correctly, though. If you switch to libthr with libmap.conf, you'll get accurate threaded %CPU reporting. -- Dan Nelson dnelson@allantgroup.com