> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Remy Horton
> Sent: Wednesday, August 24, 2016 3:58 PM
> To: thomas.monjalon at 6wind.com
> Cc: dev at dpdk.org
> Subject: [dpdk-dev] [RFC PATCH v1] rte: add bit-rate metrics to xstats
> 
> This patch adds peak and average data-rate metrics to the extended statistics.
> The intervals used to generate the statistics are controlled by any 
> application
> wishing to make use of these metrics.
> 
> Signed-off-by: Remy Horton <remy.horton at intel.com>
> ---
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c 
> index
> f62a9ec..71549b4 100644
>  static const struct rte_eth_xstats_name_off rte_rxq_stats_strings[] = {
>       {"packets", offsetof(struct rte_eth_stats, q_ipackets)}, @@ -1499,6
> +1500,7 @@ void  rte_eth_stats_reset(uint8_t port_id)  {
>       struct rte_eth_dev *dev;
> +     struct rte_eth_dev_stats *dev_stats;
> 
>       RTE_ETH_VALID_PORTID_OR_RET(port_id);
>       dev = &rte_eth_devices[port_id];
> @@ -1506,6 +1508,19 @@ rte_eth_stats_reset(uint8_t port_id)
>       RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
>       (*dev->dev_ops->stats_reset)(dev);
>       dev->data->rx_mbuf_alloc_failed = 0;
> +
> +     /* Clear device running stat counts */
> +     dev_stats = &dev->data->stats;
> +     memset(dev_stats->list_ibuckets, 0,
> +             sizeof(uint64_t) * dev_stats->cnt_buckets);
> +     memset(dev_stats->list_obuckets, 0,
> +             sizeof(uint64_t) * dev_stats->cnt_buckets);
> +     dev_stats->last_ibytes = 0;
> +     dev_stats->last_obytes = 0;
> +     dev_stats->peak_ibytes = 0;
> +     dev_stats->peak_obytes = 0;
> +     dev_stats->total_ibytes = 0;
> +     dev_stats->total_obytes = 0;
>  }
> 

Should the resetting has to be done inside rte_eth_xstats_reset() instead of 
rte_eth_stats_reset()?

Thanks,
Reshma

Reply via email to