Subject: Re: cpu load
To: <>
From: Ignatios Souvatzis <ignatios@theory.cs.uni-bonn.de>
List: port-i386
Date: 03/04/2002 12:37:12
--hK8Uo4Yp55NZU70L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Mar 01, 2002 at 04:29:42PM -0700, Rick Kelly and a few other
people earlier wrote:

> Running 'w' and 'top' simultaneously will show that top thinks the load
> is about half as high as 'w'.

=2E.. and other examples of misunderstanding of the load average computatio=
n.

Try to understand how it works:

- periodically, a timer interupts regular computation.
- it finds out how many processes are on [one of the] CPU[s] or on the=20
  RUN queue

- this is averaged into gliding averages for 1m, 5m, and 15m effective
  averaging time.

Now, on some systems (e.g. NetBSD/i386, as far as I know) this clock interu=
pt
is the same that is used for normal context switching. That is, if you have
a process that wakes up, does very little, and goes to sleep again, and=20
otherwise not much other activity, you might see it _every time_ your=20
statistical interupt service routine is running, and thus get a load average
of 1.00, although in reality the process is only using 0.01 or even less
of the CPU.

As a net result: don't trust the exact value of the load average, especially
below 1.

A better estimate is to run a long-running low-priority cpu-bound process
and look at its accounting information (e.g., time onetrillionloops); and
subtract the total wallclock time from that.

Regards,
	-is

--hK8Uo4Yp55NZU70L
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: 2.6.i

iQEVAgUBPINcYzCn4om+4LhpAQEEtAf9GkEUgegC8Jtz4tVef2LByzWommyP6a8l
Ph510tS2xJYAZ9whvwbti/U93epzy02VoajVc0J8yULsEKi2/CUOkU6OX12ArSlp
rYjp8yk9sncZNjLeFDTRs3/qvy0m5RKc2gRoqfLBEaOSJ90G0BwngCwj2fAk4qm4
ggjTcWuj216nxJqi1qLiWLv5AfTclvvw162bIFnxt8h/5lQ61C0a9IZft8GNL4cE
SJ7qsGXQFb4PklixFIjFQBgxiCKj4SAVYGb2UAKcrrqFpDMQOjUpvIgNVFyRGPux
Ea5+Mfh8mVBoOLCbzrCRYNFk6TXzc2TGqPKLGy177BX7YFJGJUZS0A==
=rYDs
-----END PGP SIGNATURE-----

--hK8Uo4Yp55NZU70L--