From owner-freebsd-stable Mon Dec 1 19:17:49 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id TAA19749 for stable-outgoing; Mon, 1 Dec 1997 19:17:49 -0800 (PST) (envelope-from owner-freebsd-stable) Received: from kinclaith.pdl.cs.cmu.edu (KINCLAITH.PDL.CS.CMU.EDU [128.2.189.18]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id TAA19733 for ; Mon, 1 Dec 1997 19:17:46 -0800 (PST) (envelope-from dpetrou@KINCLAITH.PDL.CS.CMU.EDU) Message-Id: <199712020317.TAA19733@hub.freebsd.org> Subject: RE: CPU Load To: freebsd-stable@freebsd.org Date: Mon, 1 Dec 1997 22:17:39 -0500 (EST) From: David Petrou X-Mailer: ELM [version 2.4 PL25-40] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@freebsd.org X-Loop: FreeBSD.org Precedence: bulk It seems that there's a lot of misinformation being posted here re: cpu load. Just look at the relevant code from vm/vm_meter.c: static void loadav(struct loadavg *avg) { register int i, nrun; register struct proc *p; for (nrun = 0, p = allproc.lh_first; p != 0; p = p->p_list.le_next) { switch (p->p_stat) { case SSLEEP: if (p->p_priority > PZERO || p->p_slptime != 0) continue; /* fall through */ case SRUN: case SIDL: nrun++; } } for (i = 0; i < 3; i++) avg->ldavg[i] = (cexp[i] * avg->ldavg[i] + nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT; } The important part is nrun... If a process is in SRUN or SIDL or it has a higher priority (lower numerically) than PZERO _AND_ it has slept less than a second, the process is counted. (That last clause covers fast disk operations...) David