From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <reshma.pattan@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 9EB7D29CF
 for <dev@dpdk.org>; Fri,  4 Nov 2016 17:42:54 +0100 (CET)
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga101.fm.intel.com with ESMTP; 04 Nov 2016 09:42:53 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.31,444,1473145200"; d="scan'208";a="27602264"
Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157])
 by orsmga005.jf.intel.com with ESMTP; 04 Nov 2016 09:42:52 -0700
Received: from irsmsx109.ger.corp.intel.com ([169.254.13.122]) by
 IRSMSX103.ger.corp.intel.com ([169.254.3.190]) with mapi id 14.03.0248.002;
 Fri, 4 Nov 2016 16:42:51 +0000
From: "Pattan, Reshma" <reshma.pattan@intel.com>
To: "Horton, Remy" <remy.horton@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH v3 1/3] lib: add information metrics library
Thread-Index: AQHSNkzRhkZmZA4Fxkys4gj8w5SNp6DJBpzg
Date: Fri, 4 Nov 2016 16:42:50 +0000
Message-ID: <3AEA2BF9852C6F48A459DA490692831F010C15B0@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>
In-Reply-To: <1478230579-4689-2-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: 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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 04 Nov 2016 16:42:55 -0000

Hi,

Few comments below.

> -----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
>=20
> This patch adds a new information metric library that allows other module=
s
> 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.
>=20
> Signed-off-by: Remy Horton <remy.horton@intel.com>
> ---
> +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];
> +		}

Here you also  need to include logic to return values for  port independent=
 metrics.

> diff --git a/lib/librte_metrics/rte_metrics.h b/lib/librte_metrics/rte_me=
trics.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.
> + */

Need to correct the description to "stats values" or "metric values."

> +struct rte_stat_value {

Need to change the name to rte_metric_value.

> +	/** Numeric identifier of statistic */
> +	uint16_t key;
> +	/** Value for statistic */
> +	uint64_t value;
> +};
> +
> +
> +/**
> + * Initialises statistic module. This only has to be explicitly called

Typo < Initialises>

Thanks,
Reshma