From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 18F16ADAA for ; Wed, 8 Jun 2016 03:31:54 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 07 Jun 2016 18:31:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,436,1459839600"; d="scan'208";a="982986108" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga001.fm.intel.com with ESMTP; 07 Jun 2016 18:31:55 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 7 Jun 2016 18:31:54 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 7 Jun 2016 18:31:53 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.116]) with mapi id 14.03.0248.002; Wed, 8 Jun 2016 09:31:51 +0800 From: "Wang, Zhihong" To: "De Lara Guarch, Pablo" , "dev@dpdk.org" CC: "Ananyev, Konstantin" , "Richardson, Bruce" , "thomas.monjalon@6wind.com" Thread-Topic: [PATCH v2 3/5] testpmd: show throughput in port stats Thread-Index: AQHRu/EYYSXCEhSpekGNTki9T4ej15/dSYoAgAGJCJA= Date: Wed, 8 Jun 2016 01:31:51 +0000 Message-ID: <8F6C2BD409508844A0EFC19955BE09411075A2B5@SHSMSX103.ccr.corp.intel.com> References: <1462488421-118990-1-git-send-email-zhihong.wang@intel.com> <1464751663-135211-1-git-send-email-zhihong.wang@intel.com> <1464751663-135211-4-git-send-email-zhihong.wang@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTJhNDFkMzUtYjFjNy00OGQzLWJhOTUtY2M2OTRjMDRkZmY2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkdnNDVqdXYzdzEyM2tzdG42MWwrM0p6TUlvVXp4Vzd4WHlrK3ZsaW8wVTQ9In0= x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 3/5] testpmd: show throughput in port stats 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: Wed, 08 Jun 2016 01:31:55 -0000 > -----Original Message----- > From: De Lara Guarch, Pablo > Sent: Tuesday, June 7, 2016 6:03 PM > To: Wang, Zhihong ; dev@dpdk.org > Cc: Ananyev, Konstantin ; Richardson, Bruce > ; thomas.monjalon@6wind.com > Subject: RE: [PATCH v2 3/5] testpmd: show throughput in port stats >=20 >=20 >=20 > > -----Original Message----- > > From: Wang, Zhihong > > Sent: Wednesday, June 01, 2016 4:28 AM > > To: dev@dpdk.org > > Cc: Ananyev, Konstantin; Richardson, Bruce; De Lara Guarch, Pablo; > > thomas.monjalon@6wind.com; Wang, Zhihong > > Subject: [PATCH v2 3/5] testpmd: show throughput in port stats > > > > This patch adds throughput numbers (in the period since last use of thi= s > > command) in port statistics display for "show port stats (port_id|all)"= . > > > > > > Signed-off-by: Zhihong Wang > > --- > > app/test-pmd/config.c | 20 ++++++++++++++++++++ > > 1 file changed, 20 insertions(+) > > > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > > index c611649..f487b87 100644 > > --- a/app/test-pmd/config.c > > +++ b/app/test-pmd/config.c > > @@ -92,6 +92,7 @@ > > #include > > #include > > #include > > +#include > > > > #include "testpmd.h" > > > > @@ -150,6 +151,10 @@ print_ethaddr(const char *name, struct ether_addr > > *eth_addr) > > void > > nic_stats_display(portid_t port_id) > > { > > + static uint64_t sum_rx[RTE_MAX_ETHPORTS]; > > + static uint64_t sum_tx[RTE_MAX_ETHPORTS]; > > + static uint64_t cycles[RTE_MAX_ETHPORTS]; > > + uint64_t pkt_rx, pkt_tx, cycle; >=20 > Could you rename some of these variables to something more specific? Thanks for the suggestion! Will rename them. > Like: > pkt_rx -> diff_rx_pkts > sum_rx -> prev_rx_pkts > cycle -> diff_cycles > cycles -> prev_cycles >=20 >=20 >=20 > > struct rte_eth_stats stats; > > struct rte_port *port =3D &ports[port_id]; > > uint8_t i; > > @@ -209,6 +214,21 @@ nic_stats_display(portid_t port_id) > > } > > } > > > > + cycle =3D cycles[port_id]; > > + cycles[port_id] =3D rte_rdtsc(); > > + if (cycle > 0) > > + cycle =3D cycles[port_id] - cycle; > > + > > + pkt_rx =3D stats.ipackets - sum_rx[port_id]; > > + pkt_tx =3D stats.opackets - sum_tx[port_id]; > > + sum_rx[port_id] =3D stats.ipackets; > > + sum_tx[port_id] =3D stats.opackets; > > + printf("\n Throughput (since last show)\n"); > > + printf(" RX-pps: %12"PRIu64"\n" > > + " TX-pps: %12"PRIu64"\n", > > + cycle > 0 ? pkt_rx * rte_get_tsc_hz() / cycle : 0, > > + cycle > 0 ? pkt_tx * rte_get_tsc_hz() / cycle : 0); > > + > > printf(" %s############################%s\n", > > nic_stats_border, nic_stats_border); > > } > > -- > > 2.5.0