From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 441A86A96 for ; Tue, 21 Oct 2014 12:34:51 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 21 Oct 2014 03:43:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="403454891" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by FMSMGA003.fm.intel.com with ESMTP; 21 Oct 2014 03:35:29 -0700 Received: from irsmsx107.ger.corp.intel.com (163.33.3.99) by IRSMSX101.ger.corp.intel.com (163.33.3.153) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 21 Oct 2014 11:43:04 +0100 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.175]) by IRSMSX107.ger.corp.intel.com ([169.254.10.68]) with mapi id 14.03.0195.001; Tue, 21 Oct 2014 11:43:04 +0100 From: "Richardson, Bruce" To: Neil Horman , "Liang, Cunming" Thread-Topic: [dpdk-dev] [PATCH v2 1/4] app/test: unit test for rx and tx cycles/packet Thread-Index: AQHP5LMIsQNGJDdAuUyOgB+c6Fi2fpwsQCWAgA4aiICAABLMkA== Date: Tue, 21 Oct 2014 10:43:03 +0000 Message-ID: <59AF69C657FD0841A61C55336867B5B0344212BF@IRSMSX103.ger.corp.intel.com> References: <1408947174-11323-1-git-send-email-cunming.liang@intel.com> <1412944201-30703-1-git-send-email-cunming.liang@intel.com> <1412944201-30703-2-git-send-email-cunming.liang@intel.com> <20141010175226.GG19499@hmsreliant.think-freely.org> <20141021103315.GB12795@hmsreliant.think-freely.org> In-Reply-To: <20141021103315.GB12795@hmsreliant.think-freely.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v2 1/4] app/test: unit test for rx and tx cycles/packet X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 10:34:51 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Neil Horman > Sent: Tuesday, October 21, 2014 11:33 AM > To: Liang, Cunming > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 1/4] app/test: unit test for rx and tx > cycles/packet >=20 > > > > > > > + if (count =3D=3D 0) > > > > + return -1; > > > > + > > > > + printf("%lu packet, %lu drop, %lu idle\n", count, drop, idle); > > > > + printf("Result: %ld cycles per packet\n", (cur_tsc - prev_tsc) / = count); > > > > + > > > Bad math here. Theres no guarantee that the tsc hasn't wrapped (pote= ntially > > > more than once) depending on your test length. you need to check the= tsc > before > > > and after each burst and record an average of deltas instead, account= ing in > each > > > instance for the possibility of wrap. > > [Liang, Cunming] I'm not sure catch your point correctly. > > I think both cur_tsc and prev_tsc are 64 bits width. > > For 3GHz, I think it won't wrapped so quick. > > As it's uint64_t, so even get wrapped, the delta should still be correc= t. > But theres no guarantee that the tsc starts at zero when you begin your t= est. > The system may have been up for a long time and near wrapping already. > Regardless, you need to account for the possibility that cur_tsc is small= er > than prev_tsc, or this breaks. >=20 The tsc. is 64-bit and so only wraps around every couple of hundred years o= r so on a 2GHz machine, so I don't think it's necessary to handle that case= .=20 /Bruce