From owner-freebsd-questions Sat Aug 18 21: 7:18 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-27-141-144.mmcable.com [24.27.141.144]) by hub.freebsd.org (Postfix) with SMTP id 26CE037B405 for ; Sat, 18 Aug 2001 21:07:15 -0700 (PDT) (envelope-from mwm@mired.org) Received: (qmail 69257 invoked by uid 100); 19 Aug 2001 04:07:13 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15231.15217.55553.675980@guru.mired.org> Date: Sat, 18 Aug 2001 23:07:13 -0500 To: Michael Lucas Cc: questions@freebsd.org Subject: Re: top "nice" CPU usage % In-Reply-To: <20010818180719.A62086@blackhelicopters.org> References: <106465644@toto.iv> <15230.58619.22982.65728@guru.mired.org> <20010818180719.A62086@blackhelicopters.org> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Michael Lucas types: > On Sat, Aug 18, 2001 at 04:58:19PM -0500, Mike Meyer wrote: > > I don't know of a description, but you've nailed it. This reports the > > cumulative cpu time of processes running with a nice > 0. For the > > user, nice > 0 gets less CPU time than processes with nice of 0. Nice > > < 0 can only be set by root. > So, it only reports processes where nice is less than zero, or > processes where the user has decided to be nice? Hmmm... seems it > would be more useful to report processes set to be more "hungry". Ah, > well, I'm sure patches would be welcome. :) It reports processes where the user has decided to be nice - so that nice > 0. It used to be the case - and may still be - that processes that have accumulated a lot of CPU time are niced by the system. Processes running at negative nice tend to be things that don't need a lot of CPU, but when they do, they need it *right now*. There aren't a lot of them. On my system right now, with 79 processes, exactly one has a negative nice - ntpd. If one of them starts chewing up CPU, you tend to notice right away - because everything else grinds to a halt. Having CPU running things at positive nice means one of two things. Either you've got something designed to soak up cpu nicely - setiathome on my system - so you should have 0% idle, and what is normally idle listd as nice. If they were combined, I'd see a system that's I'm not doing anything on - just this email - running at ~97% cpu usage. That would worry me. The second possibility is that you've got things that have chewed up a lot of cpu because you've been up for a while. In the latter case, you might want to nice them back up a bit. On the other hand, if that's the bulk of your CPU usage, it won't matter much. Short interactive commands running at zero will get better response than the background tasks that have risen to a positive value, which is well and good. If you want to patch things, you'll have to start with the kernel. It doesn't record values for nice < 0. Patching it to alter the meaning of nice should be trivial - a one-character change in kern/kern_clock.c. Patching it to collect both flavors of nice is a bit harder. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message