From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 26 20:25:19 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4CBAC16A4EB for ; Wed, 26 Jan 2005 20:25:19 +0000 (GMT) Received: from mail.ambrisko.com (mail.ambrisko.com [64.174.51.43]) by mx1.FreeBSD.org (Postfix) with ESMTP id 140BF43D46 for ; Wed, 26 Jan 2005 20:25:19 +0000 (GMT) (envelope-from ambrisko@ambrisko.com) Received: from server2.ambrisko.com (HELO www.ambrisko.com) (192.168.1.2) by mail.ambrisko.com with ESMTP; 26 Jan 2005 12:25:19 -0800 Received: from ambrisko.com (localhost [127.0.0.1]) by www.ambrisko.com (8.12.11/8.12.9) with ESMTP id j0QKPIsg092664; Wed, 26 Jan 2005 12:25:18 -0800 (PST) (envelope-from ambrisko@ambrisko.com) Received: (from ambrisko@localhost) by ambrisko.com (8.12.11/8.12.11/Submit) id j0QKPIIq092663; Wed, 26 Jan 2005 12:25:18 -0800 (PST) (envelope-from ambrisko) From: Doug Ambrisko Message-Id: <200501262025.j0QKPIIq092663@ambrisko.com> In-Reply-To: <200501262010.j0QKArWl041942@calamari.aero.org> To: Chris Landauer Date: Wed, 26 Jan 2005 12:25:18 -0800 (PST) X-Mailer: ELM [version 2.4ME+ PL94b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII cc: freebsd-hackers@freebsd.org Subject: Re: bug in calcru() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2005 20:25:19 -0000 Chris Landauer writes: | thanx for the suggestion - the notion of computing ut just with subtraction is | really good, since it is likely to be the largest of the three values in most | applications, but i'm a little worried that the 1024 multiplications aren't | large enough when tt gets really large - i'll do the math on it and report its | (provable) range of applicability and accuracy in a few days I understand it wouldn't be exact but it will be better then the 100% typical use ie. (10% system, 20% interrupt and 70% user). With the stuff to ensure it is monitonically increasing you can get "wacky" results so IMHO it will never be right but "good enough" Atleast that is what I recall when I tested this stuff out a long time ago. The assumption with this calculation is that st & it tend to be small compared to tt so the 1024 X shouldn't overflow much. | > Doug Ambrisko wrote | > ... | > /* Subdivide tu. try to becareful of overflow */ | > su = tu * (st * 1024 / tt) / 1024; | > iu = tu * (it * 1024 / tt) / 1024; | > uu = tu - (su + iu); | > ... Doug A.