[dpdk-dev,v7,6/6] app/test-pmd: add latency statistics calculation

Message ID 1484583573-30163-7-git-send-email-remy.horton@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Remy Horton Jan. 16, 2017, 4:19 p.m. UTC
  From: Reshma Pattan <reshma.pattan@intel.com>

Modify testpmd code to initialize/uninitialize latency statistics
calulation.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 app/test-pmd/testpmd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Comments

Van Haaren, Harry Jan. 17, 2017, 11:45 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Remy Horton
> Sent: Monday, January 16, 2017 4:20 PM
> To: dev@dpdk.org
> Cc: Pattan, Reshma <reshma.pattan@intel.com>; Thomas Monjalon <thomas.monjalon@6wind.com>
> Subject: [dpdk-dev] [PATCH v7 6/6] app/test-pmd: add latency statistics calculation
> 
> From: Reshma Pattan <reshma.pattan@intel.com>
> 
> Modify testpmd code to initialize/uninitialize latency statistics
> calulation.
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> Signed-off-by: Remy Horton <remy.horton@intel.com>

Comment inline.

> ---
>  app/test-pmd/testpmd.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index a0b7430..2874ce4 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -83,6 +83,10 @@
>  #ifdef RTE_LIBRTE_BITRATE
>  #include <rte_bitrate.h>
>  #endif
> +#include <rte_metrics.h>
> +#ifdef RTE_LIBRTE_LATENCY_STATS
> +#include <rte_latencystats.h>
> +#endif
> 
>  #include "testpmd.h"
> 
> @@ -2108,6 +2112,9 @@ signal_handler(int signum)
>  		/* uninitialize packet capture framework */
>  		rte_pdump_uninit();
>  #endif
> +#ifdef RTE_LIBRTE_LATENCY_STATS
> +		rte_latencystats_uninit();
> +#endif
>  		force_quit();
>  		/* exit with the expected status */
>  		signal(signum, SIG_DFL);
> @@ -2165,6 +2172,9 @@ main(int argc, char** argv)
>  	/* set all ports to promiscuous mode by default */
>  	FOREACH_PORT(port_id, ports)
>  		rte_eth_promiscuous_enable(port_id);
> +#ifdef RTE_LIBRTE_LATENCY_STATS
> +	rte_latencystats_init(1, NULL);
> +#endif

The 1 here represents reporting time in ns correct? 1 ns seems a very short amount of time.
Perhaps clarify (here or in the header) what exactly this number does, or set it to 0 for "as fast as possible"?

> 
>  	/* Setup bitrate stats */
>  #ifdef RTE_LIBRTE_BITRATE
> --
> 2.5.5
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a0b7430..2874ce4 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -83,6 +83,10 @@ 
 #ifdef RTE_LIBRTE_BITRATE
 #include <rte_bitrate.h>
 #endif
+#include <rte_metrics.h>
+#ifdef RTE_LIBRTE_LATENCY_STATS
+#include <rte_latencystats.h>
+#endif
 
 #include "testpmd.h"
 
@@ -2108,6 +2112,9 @@  signal_handler(int signum)
 		/* uninitialize packet capture framework */
 		rte_pdump_uninit();
 #endif
+#ifdef RTE_LIBRTE_LATENCY_STATS
+		rte_latencystats_uninit();
+#endif
 		force_quit();
 		/* exit with the expected status */
 		signal(signum, SIG_DFL);
@@ -2165,6 +2172,9 @@  main(int argc, char** argv)
 	/* set all ports to promiscuous mode by default */
 	FOREACH_PORT(port_id, ports)
 		rte_eth_promiscuous_enable(port_id);
+#ifdef RTE_LIBRTE_LATENCY_STATS
+	rte_latencystats_init(1, NULL);
+#endif
 
 	/* Setup bitrate stats */
 #ifdef RTE_LIBRTE_BITRATE