[dpdk-dev] [PATCH v3 04/17] eventdev: add APIs for extended stats

Jerin Jacob jerin.jacob at caviumnetworks.com
Sun Feb 19 13:32:25 CET 2017


On Fri, Feb 17, 2017 at 02:53:59PM +0000, Harry van Haaren wrote:
> From: Bruce Richardson <bruce.richardson at intel.com>
> 
> Add in APIs for extended stats so that eventdev implementations can report
> out information on their internal state. The APIs are based on, but not
> identical to, the equivalent ethdev functions.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> Signed-off-by: Harry van Haaren <harry.van.haaren at intel.com>
> ---
>  lib/librte_eventdev/rte_eventdev.c           |  78 ++++++++++++++++++
>  lib/librte_eventdev/rte_eventdev.h           | 118 +++++++++++++++++++++++++++
>  lib/librte_eventdev/rte_eventdev_pmd.h       |  70 ++++++++++++++++
>  lib/librte_eventdev/rte_eventdev_version.map |   4 +
>  4 files changed, 270 insertions(+)
> +
> +/**
> + * Retrieve the value of a single stat by requesting it by name.
> + *
> + * @param dev_id
> + *   The identifier of the device
> + * @param name
> + *   The stat name to retrieve
> + * @param[out] id
> + *   If non-NULL, the numerical id of the stat will be returned, so that further
> + *   requests for the stat can be got using rte_eventdev_xstats_get, which will
> + *   be faster as it doesn't need to scan a list of names for the stat.
> + *   If the stat cannot be found, the id returned will be (unsigned)-1.
> + * @return
> + *   - positive value or zero: the stat value
> + *   - negative value: -EINVAL if stat not found, -ENOTSUP if not supported.
> + */
> +uint64_t
> +rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
> +				 unsigned int *id);
> +
> +/**
> + * Reset the values of the xstats on the whole device.
> + *
> + * @param dev_id
> + *   The identifier of the device
> + * @return
> + *   - zero: successfully reset the statistics to zero
> + *   - negative value: -EINVAL invalid dev_id, -ENOTSUP if not supported.
> + */
> +int
> +rte_event_dev_xstats_reset(uint8_t dev_id);

I think it would be useful to selectively reset the specific counter if
needed.

something like below(Just to share my thought in C code)

int
rte_event_dev_xstats_reset(uint8_t dev_id,
	enum rte_event_dev_xstats_mode mode/* INT_MAX to specify all xstats on the whole device */
	const unsigned int ids /* UINT_MAX to specify all the ids on the specific mode */

Other than above comments, Its looks very good.


More information about the dev mailing list