[dpdk-dev] [PATCH v6 1/4] lib: add information metrics library

Remy Horton remy.horton at intel.com
Thu Jan 12 16:30:06 CET 2017


On 12/01/2017 13:22, Thomas Monjalon wrote:
> 2017-01-12 00:03, Remy Horton:
[..]
>> --- /dev/null
>> +++ b/lib/librte_metrics/rte_metrics.h
>> +/** Used to indicate port-independent information */
>> +#define RTE_METRICS_NONPORT -1
>
> I do not understand this constant.
> Why using the word "port" to name any device?
> What means independent?

The metric library hold two sets of values: Ones specific to ports, and 
ones that are global/aggregate. Agree "non port" is not the clearest 
choice of name..


>> +/**
>> + * Metric name
>> + */
>> +struct rte_metric_name {
>> +	/** String describing metric */
>> +	char name[RTE_METRICS_MAX_NAME_LEN];
>> +};
>
> Why a struct for a simple string?

It is modelled after xstats, which does the same thing. In this case 
thinking was that using:

rte_metrics_get_names(struct rte_metric_name *names,
	uint16_t capacity)

would be tidier than (e.g.):

rte_metrics_get_names(char *names[RTE_METRICS_MAX_NAME_LEN],
	uint16_t capacity)


>> + */
>> +struct rte_metric_value {
>> +	/** Numeric identifier of metric */
>> +	uint16_t key;
>
> How the key is bound to the name?

Corresponds to array position in struct rte_metric_name. Will amend 
doxygen comments.


> Remember how the xstats comments were improved:
> 	http://dpdk.org/commit/6d52d1d

Will take account for them. I wrote this code back in October, so it 
slipped my mind to apply the same comments to this module.


More information about the dev mailing list