From owner-freebsd-arch Mon Jan 14 9:59:57 2002 Delivered-To: freebsd-arch@freebsd.org Received: from root.com (root.com [209.102.106.178]) by hub.freebsd.org (Postfix) with ESMTP id 8B15B37B404; Mon, 14 Jan 2002 09:59:54 -0800 (PST) Received: (from dg@localhost) by root.com (8.11.2/8.11.2) id g0EHlcp09025; Mon, 14 Jan 2002 09:47:38 -0800 (PST) (envelope-from dg) Date: Mon, 14 Jan 2002 09:47:38 -0800 From: David Greenman To: Bosko Milekic Cc: "James E. Housley" , Terry Lambert , Thomas Hurst , arch@FreeBSD.org Subject: Re: 64 bit counters again Message-ID: <20020114094738.A8955@nexus.root.com> References: <3C41F3FD.4ECC8CD@mindspring.com> <20020113231459.GA30349@voi.aagh.net> <3C42390A.F9E9F533@mindspring.com> <3C42E899.CB21BD0A@FreeBSD.org> <20020114105859.A24635@technokratis.com> <3C4305E5.65BB32A6@FreeBSD.org> <20020114114911.A24990@technokratis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020114114911.A24990@technokratis.com>; from bmilekic@technokratis.com on Mon, Jan 14, 2002 at 11:49:11AM -0500 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 >> I am just trying to count bytes in and out, too keep track of usage and >> head off a large overage and a larger bill then necessary. Counting >> packets is worthless. But just do the math. With a GigE NIC, at what >> data rate do you start overflowing the counters too quickly. I suppose >> there is another possibility, that the ti GigE driver is counting the >> data multiple times. But I don't think so, because at 200Mbits/sec the >> counter should overflow in 172 seconds. And this machine is easily >> doing this most of the day. > > You're going to run into the same problem with a 64-bit counter, as >Terry pointed out. You're just going to end up moving the time it >takes from 172 seconds to some other, slightly longer, although equally >unreasonable, time. Instead of counting bytes, perhaps you should count >K or M Bytes. Just take the delta you're about to add to your counter >and divide it by something reasonable before adding it. If you are >really bent on getting accurate results, maintain a separate counter >and sum remainders in it. I'm sure you'll get slightly more accurate >data while not changing all counters to be 64-bits wide on non-64 bit >platforms (i.e., you'll keep the added execution time local to that >specific code you're working on). I think counting bytes with a 64bit counter is a perfectly reasonable thing to do. I don't think this means that we need to update ALL of the counters in the network stack to be 64bits, just the ones that are useful to network admins (which is essentially just bytes in/out and packets in/out). All the rest can stay 32bit. This isn't that much overhead to add and the results are very useful, despite what you and Terry would have some people believe. -DG David Greenman Co-founder, The FreeBSD Project - http://www.freebsd.org President, TeraSolutions, Inc. - http://www.terasolutions.com President, Download Technologies, Inc. - http://www.downloadtech.com Pave the road of life with opportunities. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message