From owner-freebsd-amd64@FreeBSD.ORG Sat Jun 4 06:34:49 2005 Return-Path: X-Original-To: freebsd-amd64@FreeBSD.org Delivered-To: freebsd-amd64@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1C39716A41C for ; Sat, 4 Jun 2005 06:34:49 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C2D743D1F for ; Sat, 4 Jun 2005 06:34:48 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout1.pacific.net.au (8.13.4/8.13.4/Debian-1) with ESMTP id j546YlT4025786; Sat, 4 Jun 2005 16:34:47 +1000 Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id j546YjAT030687; Sat, 4 Jun 2005 16:34:46 +1000 Date: Sat, 4 Jun 2005 16:34:47 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Laszlo Vitos In-Reply-To: <200506030943.40215.vitos.laszlo@gmail.com> Message-ID: <20050604162348.V5146@delplex.bde.org> References: <200506030943.40215.vitos.laszlo@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-amd64@FreeBSD.org Subject: Re: top showing incorrect CPU and WCPU on amd64? X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2005 06:34:49 -0000 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