top showing incorrect CPU and WCPU on amd64?
Bruce Evans
bde at zeta.org.au
Sat Jun 4 06:34:49 GMT 2005
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
More information about the freebsd-amd64
mailing list