From owner-freebsd-arch Wed Feb 6 9:42:27 2002 Delivered-To: freebsd-arch@freebsd.org Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by hub.freebsd.org (Postfix) with ESMTP id 1536937B433 for ; Wed, 6 Feb 2002 09:42:18 -0800 (PST) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.6/8.11.6) with ESMTP id g16HdCM10991 for ; Wed, 6 Feb 2002 18:39:12 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: arch@freebsd.org Subject: Timecounter patch for review... From: Poul-Henning Kamp Date: Wed, 06 Feb 2002 18:39:12 +0100 Message-ID: <10989.1013017152@critter.freebsd.dk> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG As I have warned about earlier, I have modfied the timecounter code to simplify the arithmetic at the bottom of it. http://phk.freebsd.dk/patch/timecounter.patch This patch changes timecounters to run off a fundamental data type "struct bintime" which is "time_t with 64 bit fractional seconds". This avoids a lot of the maddening constructs needed for arithmetic on timeval/timespec values: if (foo.tv_usec > 1000000) { foo.tv_usec -= 1000000; foo.tv_sec++; } In particular delta times as used for I/O statistics or process resource usage will be cheaper to computer. Conversions to/from the struct timeval/timespec is done with a single multiplication. Poul-Henning -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message