Re: [PATCH v3 04/17] eventdev: add APIs for extended stats
From: Van Haaren, Harry <hidden>
Date: 2017-02-20 12:12:38
-----Original Message----- From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] Sent: Sunday, February 19, 2017 12:32 PM To: Van Haaren, Harry <redacted> Cc: dev@dpdk.org; Richardson, Bruce <redacted> Subject: Re: [PATCH v3 04/17] eventdev: add APIs for extended stats
<snip>
quoted
+/** + * 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.
Ok - I like the simplicity of a single reset() covering the whole eventdev, so that the stats should be consistent. No objection to changing the API, as applications can do a full reset using the "partial" reset API if they require.
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 */
The other functions that take a mode require a "queue_port_id" to select the component (port number or queue id number). I'll add the parameter.
Also I don't like the INT_MAX solution, as the enum type doesn't have to be INT, it can be char or uintX_t - compiler and CFLAGS can be used to change the enum type IIRC.
The ids parameter is an array in the xstats_get() functions, allowing multiple ids to be retrieved in one call. This also allows a NULL parameter to indicate all. I think this suits better than a single int id, and UINT_MAX for all.
TL;DR: I'm suggesting
int
rte_event_dev_xstats_reset(uint8_t dev_id,
enum rte_event_dev_xstats_mode mode, /* device, port or queue */
int16_t queue_port_id, /* Queue or Port to reset. -1 resets all of *mode* ports or queues. */
const uint32_t ids[]); /* NULL array indicates to reset all stats */
Thoughts?
Other than above comments, Its looks very good.
Thanks for review!