From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id EE755CFBA for ; Tue, 28 Mar 2017 17:32:08 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 28 Mar 2017 08:32:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,237,1486454400"; d="scan'208";a="81924544" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by fmsmga006.fm.intel.com with ESMTP; 28 Mar 2017 08:32:07 -0700 Received: from irsmsx110.ger.corp.intel.com ([169.254.15.151]) by IRSMSX106.ger.corp.intel.com ([169.254.8.202]) with mapi id 14.03.0319.002; Tue, 28 Mar 2017 16:30:58 +0100 From: "Pattan, Reshma" To: "Horton, Remy" , "dev@dpdk.org" CC: Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v12 3/6] lib: add bitrate statistics library Thread-Index: AQHSpzf5PBmxWdRMTkKR25uyJkThSKGqU2xg Date: Tue, 28 Mar 2017 15:30:57 +0000 Message-ID: <3AEA2BF9852C6F48A459DA490692831F0112E7E3@irsmsx110.ger.corp.intel.com> References: <1490646097-27803-1-git-send-email-remy.horton@intel.com> <1490646097-27803-4-git-send-email-remy.horton@intel.com> In-Reply-To: <1490646097-27803-4-git-send-email-remy.horton@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzBiYTljNGMtZGJkOS00MmVjLTk3MmYtZjVjNTFiYjFjMWRmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlFjZDBFcHp6d1ZGVlRqVUdBQTY3OGU2TGh5aFJsb3Z0NDRvQVhIRDl0ZUE9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v12 3/6] lib: add bitrate statistics library X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Mar 2017 15:32:09 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Remy Horton > Sent: Monday, March 27, 2017 9:22 PM > To: dev@dpdk.org > Cc: Thomas Monjalon > Subject: [dpdk-dev] [PATCH v12 3/6] lib: add bitrate statistics library >=20 > This patch adds a library that calculates peak and average data-rate > statistics. For ethernet devices. These statistics are reported using the > metrics library. >=20 > Signed-off-by: Remy Horton > --- > diff --git a/doc/guides/rel_notes/release_17_02.rst > b/doc/guides/rel_notes/release_17_02.rst > index 8bd706f..63786df 100644 > --- a/doc/guides/rel_notes/release_17_02.rst > +++ b/doc/guides/rel_notes/release_17_02.rst > @@ -353,6 +353,7 @@ The libraries prepended with a plus sign were > incremented in this version. > .. code-block:: diff >=20 > librte_acl.so.2 > + + librte_bitratestats.so.1 Should be removed here and added to 17.05.rst. > a/lib/librte_bitratestats/Makefile b/lib/librte_bitratestats/Makefile > new file mode 100644 > index 0000000..743b62c > --- /dev/null > +++ b/lib/librte_bitratestats/Makefile > @@ -0,0 +1,53 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2016-2017 Intel Corporation. All rights reserved. > +# All rights reserved. > +# Year correction here and other places > +CFLAGS +=3D $(WERROR_FLAGS) -I$(SRCDIR) > + Adding -O3 flags? > +int > +rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data) { > + const char * const names[] =3D { > + "ewma_bits_in", "ewma_bits_out", > + "mean_bits_in", "mean_bits_out", > + "peak_bits_in", "peak_bits_out", > + }; > + int return_value; > + > + return_value =3D rte_metrics_reg_names(&names[0], 6); Can we passing size of namesInstead of hard coded 6 here and in some other = places below? > +int > +rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data, > + uint8_t port_id) > +{ > + /* Incoming bitrate. This is an iteratively calculated EWMA > + * (Expomentially Weighted Moving Average) that uses a > + * weighting factor of alpha_percent. An unsmoothed mean > + * for just the current time delta is also calculated for the > + * benefit of people who don't understand signal processing. > + */ > + cnt_bits =3D (eth_stats.ibytes - port_data->last_ibytes) << 3; > + port_data->last_ibytes =3D eth_stats.ibytes; > + if (cnt_bits > port_data->peak_ibits) > + port_data->peak_ibits =3D cnt_bits; > + delta =3D cnt_bits; > + delta -=3D port_data->ewma_ibits; > + /* The +-50 fixes integer rounding during divison */ > + if (delta > 0) > + delta =3D (delta * alpha_percent + 50) / 100; > + else > + delta =3D (delta * alpha_percent - 50) / 100; > + port_data->ewma_ibits +=3D delta; > + port_data->mean_ibits =3D cnt_bits; > + > + /* Outgoing bitrate (also EWMA) */ > + cnt_bits =3D (eth_stats.obytes - port_data->last_obytes) << 3; > + port_data->last_obytes =3D eth_stats.obytes; > + if (cnt_bits > port_data->peak_obits) > + port_data->peak_obits =3D cnt_bits; > + delta =3D cnt_bits; > + delta -=3D port_data->ewma_obits; > + delta =3D (delta * alpha_percent + 50) / 100; Like input bitrate calculation, should we also add if else case for delta b= eing < 0 and >0. > diff --git a/lib/librte_bitratestats/rte_bitrate.h > b/lib/librte_bitratestats/rte_bitrate.h > new file mode 100644 > index 0000000..564e4f7 > --- /dev/null > +++ b/lib/librte_bitratestats/rte_bitrate.h > @@ -0,0 +1,80 @@ > +/*- Include guards are missing for this file #ifndef _RTE_BITRATE_H_ & #define= _RTE_BITRATE_H_