From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 80A07961B for ; Tue, 7 Jun 2016 12:04:30 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 07 Jun 2016 03:04:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,432,1459839600"; d="scan'208";a="970479273" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga001.jf.intel.com with ESMTP; 07 Jun 2016 03:04:28 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.183]) by IRSMSX103.ger.corp.intel.com ([169.254.3.240]) with mapi id 14.03.0248.002; Tue, 7 Jun 2016 11:02:58 +0100 From: "De Lara Guarch, Pablo" To: "Wang, Zhihong" , "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/EYKQvbD7hC9EudUh6qF105u5/dyloA Date: Tue, 7 Jun 2016 10:02:58 +0000 Message-ID: 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: <1464751663-135211-4-git-send-email-zhihong.wang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTJhNDFkMzUtYjFjNy00OGQzLWJhOTUtY2M2OTRjMDRkZmY2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkdnNDVqdXYzdzEyM2tzdG42MWwrM0p6TUlvVXp4Vzd4WHlrK3ZsaW8wVTQ9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] 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: Tue, 07 Jun 2016 10:04:30 -0000 > -----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 >=20 > This patch adds throughput numbers (in the period since last use of this > command) in port statistics display for "show port stats (port_id|all)". >=20 >=20 > Signed-off-by: Zhihong Wang > --- > app/test-pmd/config.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) >=20 > 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 >=20 > #include "testpmd.h" >=20 > @@ -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; Could you rename some of these variables to something more specific? Like: pkt_rx -> diff_rx_pkts sum_rx -> prev_rx_pkts cycle -> diff_cycles cycles -> prev_cycles > 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) > } > } >=20 > + 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