From owner-freebsd-questions@FreeBSD.ORG Fri Sep 15 10:28:12 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 D2F2016A407; Fri, 15 Sep 2006 10:28:12 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from gaia.nimnet.asn.au (nimbin.lnk.telstra.net [139.130.45.143]) by mx1.FreeBSD.org (Postfix) with ESMTP id 814AC43D45; Fri, 15 Sep 2006 10:28:07 +0000 (GMT) (envelope-from smithi@nimnet.asn.au) Received: from localhost (smithi@localhost) by gaia.nimnet.asn.au (8.8.8/8.8.8R1.4) with SMTP id UAA02527; Fri, 15 Sep 2006 20:27:47 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Fri, 15 Sep 2006 20:27:46 +1000 (EST) From: Ian Smith To: Dan Nelson In-Reply-To: <20060914142023.GB91336@dan.emsphone.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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: Fri, 15 Sep 2006 10:28:12 -0000 On Thu, 14 Sep 2006, Dan Nelson wrote: > In the last episode (Sep 14), Ian Smith said: > [..]> > > 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. Ah, thanks for a solid boot up the learning curve, Dan. Took me a while to connect kse(2) as it's not referred to as such in ldd output, but I kept digging. For sure xmms and moz are 2 that have gone mad 'quietly'. I assume then that libkse is what the three multi-thread programs I'm running (xmms, mozilla-bin and mysqld) are now using, where for each of them `ldd $program | grep thr` shows libpthread.so.1 => /usr/lib/libpthread.so.1 So can/should I set in (a new) /etc/libmap.conf generally: libpthread.so.1 libthr.so.1 libpthread.so libthr.so or would it be better to just target these specific programs, eg: [/usr/X11R6/lib/mozilla/mozilla-bin/] # assuming loaded with full path? libpthread.so.1 libthr.so.1 libpthread.so libthr.so Are there any likely downsides to using libthr instead? Esp. mysqld? I've already found that stopping those three processes lifts shown idle to ~95%, but then I also note that ldd other things - including kdeinit ie all main KDE processes - refer to libpthread.so.1 too, but only the above 3 ever seem to appear in state 'kserel' (This is all new to me :) Cheers, Ian