From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id EED1C2BD0 for ; Mon, 7 Nov 2016 16:25:46 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 07 Nov 2016 07:25:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,606,1473145200"; d="scan'208";a="898644661" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga003.jf.intel.com with ESMTP; 07 Nov 2016 07:25:45 -0800 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.122]) by IRSMSX104.ger.corp.intel.com ([163.33.3.159]) with mapi id 14.03.0248.002; Mon, 7 Nov 2016 15:25:44 +0000 From: "Pattan, Reshma" To: "Horton, Remy" CC: "'dev@dpdk.org'" Thread-Topic: [dpdk-dev] [PATCH v3 1/3] lib: add information metrics library Thread-Index: AQHSNkzRhkZmZA4Fxkys4gj8w5SNp6DJBpzggASf4oA= Date: Mon, 7 Nov 2016 15:25:43 +0000 Message-ID: <3AEA2BF9852C6F48A459DA490692831F010C1A9E@IRSMSX109.ger.corp.intel.com> References: <1478230579-4689-1-git-send-email-remy.horton@intel.com> <1478230579-4689-2-git-send-email-remy.horton@intel.com> <3AEA2BF9852C6F48A459DA490692831F010C15B0@IRSMSX109.ger.corp.intel.com> In-Reply-To: <3AEA2BF9852C6F48A459DA490692831F010C15B0@IRSMSX109.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjBmOWJlOTktOTcyMS00MzUyLWI0MjYtY2ZiYzg5MjRlMTM0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImI2Sk9pMlBpTGNYSXdsV1V3akV4bzhHclJjYTEwNkRHYUlTNWkxdnVSNFk9In0= 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 v3 1/3] lib: add information metrics library 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: Mon, 07 Nov 2016 15:25:47 -0000 Hi, > -----Original Message----- > From: Pattan, Reshma > Sent: Friday, November 4, 2016 4:43 PM > To: Remy Horton > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v3 1/3] lib: add information metrics libra= ry >=20 > Hi, >=20 > Few comments below. >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Remy Horton > > Sent: Friday, November 4, 2016 3:36 AM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v3 1/3] lib: add information metrics > > library > > > > This patch adds a new information metric library that allows other > > modules to register named metrics and update their values. It is > > intended to be independent of ethdev, rather than mixing ethdev and > > non-ethdev information in xstats. > > > > Signed-off-by: Remy Horton > > --- > > +int > > + > > +int > > +rte_metrics_get_values(int port_id, > > + struct rte_stat_value *values, > > + uint16_t capacity) > > +{ > > + struct rte_metrics_meta_s *entry; > > + struct rte_metrics_data_s *stats; > > + const struct rte_memzone *memzone; > > + uint16_t idx_name; > > + int return_value; > > + > > + memzone =3D rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME); > > + /* If not allocated, fail silently */ > > + if (memzone =3D=3D NULL) > > + return 0; > > + stats =3D memzone->addr; > > + rte_spinlock_lock(&stats->lock); > > + > > + if (values !=3D NULL) { > > + if (capacity < stats->cnt_stats) { > > + rte_spinlock_unlock(&stats->lock); > > + return -ERANGE; > > + } > > + for (idx_name =3D 0; idx_name < stats->cnt_stats; idx_name++) > > { > > + entry =3D &stats->metadata[idx_name]; > > + values[idx_name].key =3D idx_name; > > + values[idx_name].value =3D entry->value[port_id]; > > + } >=20 > Here you also need to include logic to return values for port independe= nt > metrics. >=20 > > diff --git a/lib/librte_metrics/rte_metrics.h > > b/lib/librte_metrics/rte_metrics.h > > new file mode 100644 > > index 0000000..6b75404 > > --- /dev/null > > +++ b/lib/librte_metrics/rte_metrics.h > > @@ -0,0 +1,204 @@ > > +/** > > + * Statistic name > > + */ > > +struct rte_metric_name { > > + /** String describing statistic */ > > + char name[RTE_METRICS_MAX_NAME_LEN]; }; > > + > > + > > +/** > > + * Statistic name. > > + */ >=20 > Need to correct the description to "stats values" or "metric values." >=20 > > +struct rte_stat_value { >=20 > Need to change the name to rte_metric_value. >=20 > > + /** Numeric identifier of statistic */ > > + uint16_t key; > > + /** Value for statistic */ > > + uint64_t value; > > +}; > > + > > + > > +/** > > + * Initialises statistic module. This only has to be explicitly > > +called >=20 > Typo < Initialises> To avoid confusion, here I mean to say "Initializes" should be used (i.e. U= S English) . Also another non-related comment, you may need to add a comment about EMWA near the mean bit rate calculation code. >=20 > Thanks, > Reshma