DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Pattan, Reshma" <reshma.pattan@intel.com>
To: "Horton, Remy" <remy.horton@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Thomas Monjalon <thomas.monjalon@6wind.com>
Subject: Re: [dpdk-dev] [PATCH v12 3/6] lib: add bitrate statistics library
Date: Tue, 28 Mar 2017 15:30:57 +0000	[thread overview]
Message-ID: <3AEA2BF9852C6F48A459DA490692831F0112E7E3@irsmsx110.ger.corp.intel.com> (raw)
In-Reply-To: <1490646097-27803-4-git-send-email-remy.horton@intel.com>



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Remy Horton
> Sent: Monday, March 27, 2017 9:22 PM
> To: dev@dpdk.org
> Cc: Thomas Monjalon <thomas.monjalon@6wind.com>
> Subject: [dpdk-dev] [PATCH v12 3/6] lib: add bitrate statistics library
> 
> This patch adds a library that calculates peak and average data-rate
> statistics. For ethernet devices. These statistics are reported using the
> metrics library.
> 
> Signed-off-by: Remy Horton <remy.horton@intel.com>
> ---
> diff --git a/doc/guides/rel_notes/release_17_02.rst
> b/doc/guides/rel_notes/release_17_02.rst
> index 8bd706f..63786df 100644
> --- a/doc/guides/rel_notes/release_17_02.rst
> +++ b/doc/guides/rel_notes/release_17_02.rst
> @@ -353,6 +353,7 @@ The libraries prepended with a plus sign were
> incremented in this version.
>  .. code-block:: diff
> 
>       librte_acl.so.2
> +   + librte_bitratestats.so.1

Should be removed here and added to 17.05.rst.

> a/lib/librte_bitratestats/Makefile b/lib/librte_bitratestats/Makefile
> new file mode 100644
> index 0000000..743b62c
> --- /dev/null
> +++ b/lib/librte_bitratestats/Makefile
> @@ -0,0 +1,53 @@
> +#   BSD LICENSE
> +#
> +#   Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
> +#   All rights reserved.
> +#

Year correction here and other places

> +CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
> +

Adding -O3 flags?

> +int
> +rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data) {
> +	const char * const names[] = {
> +		"ewma_bits_in", "ewma_bits_out",
> +		"mean_bits_in", "mean_bits_out",
> +		"peak_bits_in", "peak_bits_out",
> +	};
> +	int return_value;
> +
> +	return_value = rte_metrics_reg_names(&names[0], 6);

Can we passing size of namesInstead of hard coded 6 here and in some other places below?

> +int
> +rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
> +	uint8_t port_id)
> +{
> +	/* Incoming bitrate. This is an iteratively calculated EWMA
> +	 * (Expomentially Weighted Moving Average) that uses a
> +	 * weighting factor of alpha_percent. An unsmoothed mean
> +	 * for just the current time delta is also calculated for the
> +	 * benefit of people who don't understand signal processing.
> +	 */
> +	cnt_bits = (eth_stats.ibytes - port_data->last_ibytes) << 3;
> +	port_data->last_ibytes = eth_stats.ibytes;
> +	if (cnt_bits > port_data->peak_ibits)
> +		port_data->peak_ibits = cnt_bits;
> +	delta = cnt_bits;
> +	delta -= port_data->ewma_ibits;
> +	/* The +-50 fixes integer rounding during divison */
> +	if (delta > 0)
> +		delta = (delta * alpha_percent + 50) / 100;
> +	else
> +		delta = (delta * alpha_percent - 50) / 100;
> +	port_data->ewma_ibits += delta;
> +	port_data->mean_ibits = cnt_bits;
> +
> +	/* Outgoing bitrate (also EWMA) */
> +	cnt_bits = (eth_stats.obytes - port_data->last_obytes) << 3;
> +	port_data->last_obytes = eth_stats.obytes;
> +	if (cnt_bits > port_data->peak_obits)
> +		port_data->peak_obits = cnt_bits;
> +	delta = cnt_bits;
> +	delta -= port_data->ewma_obits;
> +	delta = (delta * alpha_percent + 50) / 100;

Like input bitrate calculation, should we also add if else case for delta being < 0 and >0.

> diff --git a/lib/librte_bitratestats/rte_bitrate.h
> b/lib/librte_bitratestats/rte_bitrate.h
> new file mode 100644
> index 0000000..564e4f7
> --- /dev/null
> +++ b/lib/librte_bitratestats/rte_bitrate.h
> @@ -0,0 +1,80 @@
> +/*-

Include guards are missing for this file  #ifndef _RTE_BITRATE_H_ & #define _RTE_BITRATE_H_

  reply	other threads:[~2017-03-28 15:32 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 20:21 [dpdk-dev] [PATCH v12 0/6] Expanded statistics reporting Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 1/6] lib: add information metrics library Remy Horton
2017-03-28 14:14   ` Pattan, Reshma
2017-03-28 15:00     ` Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 2/6] app/proc_info: add metrics displaying Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 3/6] lib: add bitrate statistics library Remy Horton
2017-03-28 15:30   ` Pattan, Reshma [this message]
2017-03-28 15:45     ` Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 4/6] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-03-28 15:49   ` Pattan, Reshma
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 5/6] lib: added new library for latency stats Remy Horton
2017-03-27 20:21 ` [dpdk-dev] [PATCH v12 6/6] app/test-pmd: add latency statistics calculation Remy Horton
2017-03-27 21:03 ` [dpdk-dev] [PATCH v12 0/6] Expanded statistics reporting Stephen Hemminger
2017-03-28 11:21   ` Mcnamara, John
2017-03-29 18:28 ` [dpdk-dev] [PATCH v13 " Remy Horton
2017-03-29 18:28   ` [dpdk-dev] [PATCH v13 1/6] lib: add information metrics library Remy Horton
2017-03-30 10:01     ` Pattan, Reshma
2017-03-29 18:28   ` [dpdk-dev] [PATCH v13 2/6] app/proc_info: add metrics displaying Remy Horton
2017-03-29 18:28   ` [dpdk-dev] [PATCH v13 3/6] lib: add bitrate statistics library Remy Horton
2017-03-30 10:04     ` Pattan, Reshma
2017-03-30 10:08     ` Pattan, Reshma
2017-03-29 18:28   ` [dpdk-dev] [PATCH v13 4/6] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-03-29 18:28   ` [dpdk-dev] [PATCH v13 5/6] lib: added new library for latency stats Remy Horton
2017-03-29 18:28   ` [dpdk-dev] [PATCH v13 6/6] app/test-pmd: add latency statistics calculation Remy Horton
2017-03-30 10:22     ` Pattan, Reshma
2017-03-30 13:18   ` [dpdk-dev] [PATCH v13 0/6] Expanded statistics reporting Pattan, Reshma
2017-03-30 21:00   ` [dpdk-dev] [PATCH v14 " Remy Horton
2017-03-30 21:00     ` [dpdk-dev] [PATCH v14 1/6] lib: add information metrics library Remy Horton
2017-04-05 13:39       ` Thomas Monjalon
2017-04-05 14:46         ` Remy Horton
2017-04-05 15:06           ` Thomas Monjalon
2017-04-05 15:16             ` Remy Horton
2017-04-05 15:23               ` Thomas Monjalon
2017-03-30 21:00     ` [dpdk-dev] [PATCH v14 2/6] app/proc_info: add metrics displaying Remy Horton
2017-03-30 21:00     ` [dpdk-dev] [PATCH v14 3/6] lib: add bitrate statistics library Remy Horton
2017-03-30 21:01     ` [dpdk-dev] [PATCH v14 4/6] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-03-30 21:01     ` [dpdk-dev] [PATCH v14 5/6] lib: added new library for latency stats Remy Horton
2017-04-05 14:24       ` Thomas Monjalon
2017-04-05 14:34         ` Remy Horton
2017-03-30 21:01     ` [dpdk-dev] [PATCH v14 6/6] app/test-pmd: add latency statistics calculation Remy Horton
2017-04-05 16:01     ` [dpdk-dev] [PATCH v14 0/6] Expanded statistics reporting Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3AEA2BF9852C6F48A459DA490692831F0112E7E3@irsmsx110.ger.corp.intel.com \
    --to=reshma.pattan@intel.com \
    --cc=dev@dpdk.org \
    --cc=remy.horton@intel.com \
    --cc=thomas.monjalon@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).