Date: Sat, 4 Jun 2005 16:34:47 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Laszlo Vitos <vitos.laszlo@gmail.com> Cc: freebsd-amd64@FreeBSD.org Subject: Re: top showing incorrect CPU and WCPU on amd64? Message-ID: <20050604162348.V5146@delplex.bde.org> In-Reply-To: <200506030943.40215.vitos.laszlo@gmail.com> References: <200506030943.40215.vitos.laszlo@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 3 Jun 2005, Laszlo Vitos wrote: > I observed a strange behavior of top on FreeBSD 5.4-RELEASE on AMD64. It seems > like the CPU and WCPU columns in top are an average over the running time of > a process. A small test program confirmed this. It sleeps for 2 seconds, then > goes over a few iterations of: hogs the cpu in a loop, then sleeps again for > a few seconds. > The result: CPU and WCPU never reach 100%, nor 0%, they are growing/shrinking > in small increments during the process' run time, depending on whether the > process is sleeping or looping. > Attached is the test program. Can anyone confirm whether this is the expected > behavior (and if so, why?)? No test program is attached :-). I think this is the expected beviour. CPU is a long-term average. Thus if a process runs for half the time and sleeps for half the time, its CPU will be about 50%. It won't be exactly 50% since more weight is given to recent history. WCPU is mostly bogus. It is an attempt to undo the weighting but not enough history is kept to do this correctly and the history which is used is close to being garbage. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050604162348.V5146>