From owner-freebsd-amd64@FreeBSD.ORG Tue Jun 7 10:55:58 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 87A2916A41C for ; Tue, 7 Jun 2005 10:55:58 +0000 (GMT) (envelope-from vitos.laszlo@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2D0B043D1D for ; Tue, 7 Jun 2005 10:55:58 +0000 (GMT) (envelope-from vitos.laszlo@gmail.com) Received: by wproxy.gmail.com with SMTP id 69so191584wra for ; Tue, 07 Jun 2005 03:55:57 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:organization:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=D0Uv75xOL5misnufZFOW3oZcZgwxNmna7dcYK7hTEVEQuWndek0c3oKhA8nOE+MRaN69BmEHNR0YLT2KfEOyM3zTwP0UJbW7dVMVTi1FOSLFyqGTlXranABMXlhNvfGsATiKHlLOogCBIGzC+mgqSXoOHGcRFR1U9ZEeLvnHFwE= Received: by 10.54.5.47 with SMTP id 47mr3766226wre; Tue, 07 Jun 2005 03:55:57 -0700 (PDT) Received: from laca.evol.ro ([193.230.202.166]) by mx.gmail.com with ESMTP id 26sm704650wrl.2005.06.07.03.55.56; Tue, 07 Jun 2005 03:55:57 -0700 (PDT) From: Laszlo Vitos Organization: - To: Bruce Evans Date: Tue, 7 Jun 2005 13:55:53 +0300 User-Agent: KMail/1.7.2 References: <200506030943.40215.vitos.laszlo@gmail.com> <20050604162348.V5146@delplex.bde.org> In-Reply-To: <20050604162348.V5146@delplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506071355.53607.vitos.laszlo@gmail.com> 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: Tue, 07 Jun 2005 10:55:58 -0000 On Saturday 04 June 2005 09:34, Bruce Evans wrote: > 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 :-). Yes, sorry about that, I don't know why it did not go through. > > 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. In the meantime I dug into the sched_* sources a bit and realised that indeed, that is the case. Sorry that I didn't look first, but it did not cross my mind that this is actually what the expected behaviour supposed to be. I guess there were a few flame wars about this in the past :) Anyway, thanks for the info, laca