[dpdk-dev] [PATCH v5] app/testpmd: add option to display extended statistics
Ferruh Yigit
ferruh.yigit at intel.com
Thu Oct 14 09:43:29 CEST 2021
On 9/15/2021 12:27 PM, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
>
> Add 'display-xstats' option for using in accompanying with Rx/Tx statistics
> (i.e. 'stats-period' option or 'show port stats' interactive command) to
> display specified list of extended statistics.
>
> Signed-off-by: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
> Acked-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
<...>
> +static int
> +alloc_xstats_display_info(portid_t pi)
> +{
> + uint64_t **ids_supp = &ports[pi].xstats_info.ids_supp;
> + uint64_t **prev_values = &ports[pi].xstats_info.prev_values;
> + uint64_t **curr_values = &ports[pi].xstats_info.curr_values;
> +
> + if (xstats_display_num == 0)
> + return 0;
> +
> + *ids_supp = calloc(xstats_display_num, sizeof(**ids_supp));
> + if (*ids_supp == NULL)
> + return -ENOMEM;
> +
> + *prev_values = calloc(xstats_display_num,
> + sizeof(**prev_values));
> + if (*prev_values == NULL)
> + return -ENOMEM;
> +
> + *curr_values = calloc(xstats_display_num,
> + sizeof(**curr_values));
> + if (*curr_values == NULL)
> + return -ENOMEM;
Can be good to free above allocated memory before return.
<...>
> @@ -2886,6 +2990,7 @@ close_port(portid_t pid)
>
> if (is_proc_primary()) {
> port_flow_flush(pi);
> + free_xstats_display_info(pi);
Why free only for primary process?
Aren't these allocated in testpmd level per process?
<...>
> +
> +#define XSTAT_ID_INVALID UINT64_MAX
Is this macro used at all?
More information about the dev
mailing list