From owner-freebsd-arch Mon Jan 14 18:36:38 2002 Delivered-To: freebsd-arch@freebsd.org Received: from albatross.prod.itd.earthlink.net (albatross.mail.pas.earthlink.net [207.217.120.120]) by hub.freebsd.org (Postfix) with ESMTP id 7562837B41E; Mon, 14 Jan 2002 18:36:35 -0800 (PST) Received: from pool0039.cvx22-bradley.dialup.earthlink.net ([209.179.198.39] helo=mindspring.com) by albatross.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16QJSd-0006M9-00; Mon, 14 Jan 2002 18:36:27 -0800 Message-ID: <3C4395A7.EC3F89A7@mindspring.com> Date: Mon, 14 Jan 2002 18:36:23 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: David Greenman Cc: "James E. Housley" , Bosko Milekic , Thomas Hurst , arch@FreeBSD.org Subject: Re: 64 bit counters again 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> <20020114094738.A8955@nexus.root.com> <3C4334A1.6601C5ED@mindspring.com> <3C4338EA.1D698EF1@FreeBSD.org> <20020114115433.D8955@nexus.root.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 David Greenman wrote: > >That sounds reasonable. 1024 might be a problem becuase of smaller ACK > >or setup packets, but the concept is reasonable. I would like to know > >the amount of data transmitted and received because that is what we are > >billed on. And at that datarate, to the bit accuracy is crazy. But the > >results should be close enough to reality to be able to trust it with a > >small fudge fact for saftey. > > It's not reasonable because most packets are either small (40 bytes) > or MTU sized. The distribution of sizes is not random and keeping only > 1K internal precision would not result in anything near accurate in terms > of bps. There is a difference between *precision* and *accuracy*. Here is how he could get a 2^10 reduce precision, with 0 reduction in accuracy: He would update his 32 bit byte counter, then he would div it by 1024 (load register from register, shift 10), then add this value to his global counter. Note that he *never* throws away the 10 bits of byte count, he just doesn't externalize it. It gets added to the next set of update values, so at worst, he will be low by a movign average of 512b in any given interval. There would be no loss of overall information, as you seem to be implying with your reference to 40 byte packets. Since the BPS is an *average*, and since the second resolution is *vastly* larger than the modification interval, there should be no problem with this approach. Obviously, the same approach works for any modularl counter modulo, so 20 bits (M instead of K) works, as well, if he needs that resolution because the data rate per second is so high relative to the sampling interval that overflow is ever a risk. Make sense? The point is that the modular counter never needs to be globally locked against contention, so we don't add all the locking that would be necessary for a full 64 bits of precision on a 32 bit architecture. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message