From owner-freebsd-net@FreeBSD.ORG Mon Mar 15 17:42:09 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D231816A4CE for ; Mon, 15 Mar 2004 17:42:09 -0800 (PST) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id AC1C143D1D for ; Mon, 15 Mar 2004 17:42:09 -0800 (PST) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.10/8.12.3) with ESMTP id i2G1g6Za013769; Mon, 15 Mar 2004 17:42:06 -0800 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.10/8.12.3/Submit) id i2G1g67l013768; Mon, 15 Mar 2004 17:42:06 -0800 Date: Mon, 15 Mar 2004 17:42:06 -0800 From: Brooks Davis To: Mike Jakubik Message-ID: <20040316014206.GA12382@Odin.AC.HMC.Edu> References: <2650.192.168.0.200.1079393908.squirrel@192.168.0.1> <20040316000153.GA73860@router.laiers.local> <2662.192.168.0.200.1079396323.squirrel@192.168.0.1> <20040316004046.GA74287@router.laiers.local> <2697.192.168.0.200.1079398101.squirrel@192.168.0.1> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NzB8fVQJ5HfG6fxh" Content-Disposition: inline In-Reply-To: <2697.192.168.0.200.1079398101.squirrel@192.168.0.1> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-milter (http://amavis.org/) on odin.ac.hmc.edu cc: Max Laier cc: net@freebsd.org Subject: Re: Byte counters reset at ~4GB X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2004 01:42:10 -0000 --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 15, 2004 at 07:48:21PM -0500, Mike Jakubik wrote: > Max Laier said: >=20 > > Sure, you measure it ;) ... no, of course it is more expensive to updat= e a > > 64bit counter on a 32bit arch, but the key (once again) is descision: > > While > > (almost) all of the pf counters are 64bit types you can configure it not > > to > > use the loginterface or whatsoever more. So it's up to you: You need 64= bit > > counters? You shall have them! You need *fast* 64bit counters? AMD sells > > nice processors (they say)! ... you get the idea. >=20 > Got it. In just curious though... realistically, how big of an impact on > performance is this on a modern CPU? Is it not simply the original 32bit > calculation x 2? No, you have to do overflow handling so that adds some to the cost. I was curious what the actual overhead was so I ran the following program with both uint32_t and uint64_t counters. With 64-bit counters, it was a bit over four times slower on a the dual 2.2GHz Xeon (~2sec vs ~8.4sec). On a dual opteron, the 32-bit math had a slight edge, but not much. Intestingly, runtime was longer then on the Xeon (~3.1s for 32-bit and ~3.8 for 64-bit.) If you do this test, be sure not to use any optimizer flags or the whole loop gets optimized out. -- Brooks #include #include int main (int argc, char **argv) { uint32_t j =3D 0; for (j =3D 0; j < 1000000000; j++) {} printf("%d\n", j); } --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --NzB8fVQJ5HfG6fxh Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFAVltsXY6L6fI4GtQRAl2rAJ9x2sxnvvzd+Wx8atFF2g01CX22twCfRJwv RUwgo98YRpEj4APbFOEotwo= =vDX/ -----END PGP SIGNATURE----- --NzB8fVQJ5HfG6fxh--