DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: print statistics periodically
@ 2017-05-28 21:38 Pablo de Lara
  2017-06-07  9:11 ` Wu, Jingjing
  2017-06-09  1:46 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
  0 siblings, 2 replies; 18+ messages in thread
From: Pablo de Lara @ 2017-05-28 21:38 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, Pablo de Lara

Add parameter to print port statistics periodically
(disabled by default), if interactive mode is not enabled.

This is useful to allow the user to see port statistics
without having to get into the internal command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test-pmd/parameters.c             | 15 ++++++++++++-
 app/test-pmd/testpmd.c                | 40 ++++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  5 +++++
 4 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index fbe6284..a758b25 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -89,6 +89,7 @@ usage(char* progname)
 	       "[--cmdline-file=FILENAME] "
 #endif
 	       "[--help|-h] | [--auto-start|-a] | ["
+	       "-T PERIOD: statistics will be shown every PERIOD seconds (only if interactive is disabled)"
 	       "--coremask=COREMASK --portmask=PORTMASK --numa "
 	       "--mbuf-size= | --total-num-mbufs= | "
 	       "--nb-cores= | --nb-ports= | "
@@ -639,7 +640,7 @@ launch_args_parse(int argc, char** argv)
 #else
 #define SHORTOPTS ""
 #endif
-	while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ah",
+	while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ahT:",
 				 lgopts, &opt_idx)) != EOF) {
 		switch (opt) {
 #ifdef RTE_LIBRTE_CMDLINE
@@ -653,6 +654,18 @@ launch_args_parse(int argc, char** argv)
 			auto_start = 1;
 			break;
 
+		case 'T':
+		{
+			char *end = NULL;
+			unsigned int n;
+
+			n = strtoul(optarg, &end, 10);
+			if ((optarg[0] == '\0') || (end == NULL) || (*end != '\0'))
+				break;
+
+			stats_period = n;
+			break;
+		}
 		case 0: /*long options */
 			if (!strcmp(lgopts[opt_idx].name, "help")) {
 				usage(argv[0]);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index d1041af..2ab783d 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -177,7 +177,7 @@ uint32_t burst_tx_retry_num = BURST_TX_RETRIES;
 uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */
 uint32_t param_total_num_mbufs = 0;  /**< number of mbufs in all pools - if
                                       * specified on command-line. */
-
+uint16_t stats_period; /**< Period to show statistics (disabled by default) */
 /*
  * Configuration of packet segments used by the "txonly" processing engine.
  */
@@ -2229,6 +2229,21 @@ force_quit(void)
 }
 
 static void
+print_stats(void)
+{
+	uint8_t i;
+	const char clr[] = { 27, '[', '2', 'J', '\0' };
+	const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };
+
+	/* Clear screen and move to top left */
+	printf("%s%s", clr, topLeft);
+
+	printf("\nPort statistics ====================================");
+	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
+		nic_stats_display(fwd_ports_ids[i]);
+}
+
+static void
 signal_handler(int signum)
 {
 	if (signum == SIGINT || signum == SIGTERM) {
@@ -2351,8 +2366,31 @@ main(int argc, char** argv)
 
 		printf("No commandline core given, start packet forwarding\n");
 		start_packet_forwarding(0);
+		if (stats_period != 0) {
+			uint64_t prev_tsc = 0, cur_tsc, timer_tsc = 0;
+			uint64_t timer_period;
+
+			/* Convert to number of cycles */
+			timer_period = stats_period * rte_get_timer_hz();
+
+			while (1) {
+				cur_tsc = rte_rdtsc();
+				timer_tsc += cur_tsc - prev_tsc;
+
+				if (timer_tsc >= timer_period) {
+					print_stats();
+					/* Reset the timer */
+					timer_tsc = 0;
+				}
+				/* Sleep to avoid unnecessary checks */
+				sleep(1);
+				prev_tsc = cur_tsc;
+			}
+		}
+
 		printf("Press enter to exit\n");
 		rc = read(0, &c, 1);
+
 		pmd_test_exit();
 		if (rc < 0)
 			return 1;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index e6c43ba..8de3379 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -378,6 +378,7 @@ extern enum dcb_queue_mapping_mode dcb_q_mapping;
 extern uint16_t mbuf_data_size; /**< Mbuf data space size. */
 extern uint32_t param_total_num_mbufs;
 
+extern uint16_t stats_period;
 
 #ifdef RTE_LIBRTE_LATENCY_STATS
 extern uint8_t latencystats_enabled;
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 2a43214..bebe46a 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -188,6 +188,11 @@ The commandline options are:
 
     Start forwarding on initialization.
 
+*   ``-T PERIOD``
+
+    Display statistics every PERIOD seconds, if interactive mode is disabled.
+    The default value is 0, which means that the statistics will not be displayed.
+
 *   ``--nb-cores=N``
 
     Set the number of forwarding cores,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: print statistics periodically
  2017-05-28 21:38 [dpdk-dev] [PATCH] app/testpmd: print statistics periodically Pablo de Lara
@ 2017-06-07  9:11 ` Wu, Jingjing
  2017-06-07 13:13   ` De Lara Guarch, Pablo
  2017-06-09  1:46 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
  1 sibling, 1 reply; 18+ messages in thread
From: Wu, Jingjing @ 2017-06-07  9:11 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: dev



> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Monday, May 29, 2017 5:39 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [PATCH] app/testpmd: print statistics periodically
> 
> Add parameter to print port statistics periodically
> (disabled by default), if interactive mode is not enabled.
> 
> This is useful to allow the user to see port statistics
> without having to get into the internal command line.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>  app/test-pmd/parameters.c             | 15 ++++++++++++-
>  app/test-pmd/testpmd.c                | 40
> ++++++++++++++++++++++++++++++++++-
>  app/test-pmd/testpmd.h                |  1 +
>  doc/guides/testpmd_app_ug/run_app.rst |  5 +++++
>  4 files changed, 59 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> index fbe6284..a758b25 100644
> --- a/app/test-pmd/parameters.c
> +++ b/app/test-pmd/parameters.c
> @@ -89,6 +89,7 @@ usage(char* progname)
>  	       "[--cmdline-file=FILENAME] "
>  #endif
>  	       "[--help|-h] | [--auto-start|-a] | ["
> +	       "-T PERIOD: statistics will be shown every PERIOD seconds (only if interactive is
How about change it following format?

"[--help|-h] | [--auto-start|-a] | [ -T PERIOD] | ["
"-T PERIOD: statistics will be shown every PERIOD seconds (only if interactive is
"--coremask=COREMASK --portmask=PORTMASK --numa "


Add line after printf("  --help: ......
printf("-T PERIOD: statistics will be shown every PERIOD seconds (only if interactive is disabled)\n");

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH] app/testpmd: print statistics periodically
  2017-06-07  9:11 ` Wu, Jingjing
@ 2017-06-07 13:13   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 18+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-07 13:13 UTC (permalink / raw)
  To: Wu, Jingjing; +Cc: dev

Hi Jingjing,

> -----Original Message-----
> From: Wu, Jingjing
> Sent: Wednesday, June 07, 2017 10:12 AM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] app/testpmd: print statistics periodically
> 
> 
> 
> > -----Original Message-----
> > From: De Lara Guarch, Pablo
> > Sent: Monday, May 29, 2017 5:39 AM
> > To: Wu, Jingjing <jingjing.wu@intel.com>
> > Cc: dev@dpdk.org; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> > Subject: [PATCH] app/testpmd: print statistics periodically
> >
> > Add parameter to print port statistics periodically
> > (disabled by default), if interactive mode is not enabled.
> >
> > This is useful to allow the user to see port statistics
> > without having to get into the internal command line.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
> >  app/test-pmd/parameters.c             | 15 ++++++++++++-
> >  app/test-pmd/testpmd.c                | 40
> > ++++++++++++++++++++++++++++++++++-
> >  app/test-pmd/testpmd.h                |  1 +
> >  doc/guides/testpmd_app_ug/run_app.rst |  5 +++++
> >  4 files changed, 59 insertions(+), 2 deletions(-)
> >
> > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> > index fbe6284..a758b25 100644
> > --- a/app/test-pmd/parameters.c
> > +++ b/app/test-pmd/parameters.c
> > @@ -89,6 +89,7 @@ usage(char* progname)
> >  	       "[--cmdline-file=FILENAME] "
> >  #endif
> >  	       "[--help|-h] | [--auto-start|-a] | ["
> > +	       "-T PERIOD: statistics will be shown every PERIOD seconds (only
> if interactive is
> How about change it following format?
> 
> "[--help|-h] | [--auto-start|-a] | [ -T PERIOD] | ["
> "-T PERIOD: statistics will be shown every PERIOD seconds (only if
> interactive is
> "--coremask=COREMASK --portmask=PORTMASK --numa "
> 
> 
> Add line after printf("  --help: ......
> printf("-T PERIOD: statistics will be shown every PERIOD seconds (only if
> interactive is disabled)\n");
> 

Agreed. Will change this, thanks for the review.

Pablo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH v2] app/testpmd: print statistics periodically
  2017-05-28 21:38 [dpdk-dev] [PATCH] app/testpmd: print statistics periodically Pablo de Lara
  2017-06-07  9:11 ` Wu, Jingjing
@ 2017-06-09  1:46 ` Pablo de Lara
  2017-06-15  1:48   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
  2017-06-19  0:54   ` [dpdk-dev] [PATCH v2] " Wu, Jingjing
  1 sibling, 2 replies; 18+ messages in thread
From: Pablo de Lara @ 2017-06-09  1:46 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, Pablo de Lara

Add parameter to print port statistics periodically
(disabled by default), if interactive mode is not enabled.

This is useful to allow the user to see port statistics
without having to get into the internal command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---

Changes in v2:

- Added extra argument in help 

 app/test-pmd/parameters.c             | 19 +++++++++++++++--
 app/test-pmd/testpmd.c                | 40 ++++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  5 +++++
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index fbe6284..230ca2c 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -88,7 +88,7 @@ usage(char* progname)
 	       "[--interactive|-i] "
 	       "[--cmdline-file=FILENAME] "
 #endif
-	       "[--help|-h] | [--auto-start|-a] | ["
+	       "[--help|-h] | [--auto-start|-a] | [-T PERIOD] ["
 	       "--coremask=COREMASK --portmask=PORTMASK --numa "
 	       "--mbuf-size= | --total-num-mbufs= | "
 	       "--nb-cores= | --nb-ports= | "
@@ -109,6 +109,8 @@ usage(char* progname)
 	printf("  --auto-start: start forwarding on init "
 	       "[always when non-interactive].\n");
 	printf("  --help: display this message and quit.\n");
+	printf("  -T PERIOD: statistics will be shown every PERIOD seconds "
+	       "(only if interactive is disabled).\n");
 	printf("  --nb-cores=N: set the number of forwarding cores "
 	       "(1 <= N <= %d).\n", nb_lcores);
 	printf("  --nb-ports=N: set the number of forwarding ports "
@@ -639,7 +641,7 @@ launch_args_parse(int argc, char** argv)
 #else
 #define SHORTOPTS ""
 #endif
-	while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ah",
+	while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ahT:",
 				 lgopts, &opt_idx)) != EOF) {
 		switch (opt) {
 #ifdef RTE_LIBRTE_CMDLINE
@@ -653,6 +655,19 @@ launch_args_parse(int argc, char** argv)
 			auto_start = 1;
 			break;
 
+		case 'T':
+		{
+			char *end = NULL;
+			unsigned int n;
+
+			n = strtoul(optarg, &end, 10);
+			if ((optarg[0] == '\0') || (end == NULL) ||
+					(*end != '\0'))
+				break;
+
+			stats_period = n;
+			break;
+		}
 		case 0: /*long options */
 			if (!strcmp(lgopts[opt_idx].name, "help")) {
 				usage(argv[0]);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index d1041af..2ab783d 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -177,7 +177,7 @@ uint32_t burst_tx_retry_num = BURST_TX_RETRIES;
 uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */
 uint32_t param_total_num_mbufs = 0;  /**< number of mbufs in all pools - if
                                       * specified on command-line. */
-
+uint16_t stats_period; /**< Period to show statistics (disabled by default) */
 /*
  * Configuration of packet segments used by the "txonly" processing engine.
  */
@@ -2229,6 +2229,21 @@ force_quit(void)
 }
 
 static void
+print_stats(void)
+{
+	uint8_t i;
+	const char clr[] = { 27, '[', '2', 'J', '\0' };
+	const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };
+
+	/* Clear screen and move to top left */
+	printf("%s%s", clr, topLeft);
+
+	printf("\nPort statistics ====================================");
+	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
+		nic_stats_display(fwd_ports_ids[i]);
+}
+
+static void
 signal_handler(int signum)
 {
 	if (signum == SIGINT || signum == SIGTERM) {
@@ -2351,8 +2366,31 @@ main(int argc, char** argv)
 
 		printf("No commandline core given, start packet forwarding\n");
 		start_packet_forwarding(0);
+		if (stats_period != 0) {
+			uint64_t prev_tsc = 0, cur_tsc, timer_tsc = 0;
+			uint64_t timer_period;
+
+			/* Convert to number of cycles */
+			timer_period = stats_period * rte_get_timer_hz();
+
+			while (1) {
+				cur_tsc = rte_rdtsc();
+				timer_tsc += cur_tsc - prev_tsc;
+
+				if (timer_tsc >= timer_period) {
+					print_stats();
+					/* Reset the timer */
+					timer_tsc = 0;
+				}
+				/* Sleep to avoid unnecessary checks */
+				sleep(1);
+				prev_tsc = cur_tsc;
+			}
+		}
+
 		printf("Press enter to exit\n");
 		rc = read(0, &c, 1);
+
 		pmd_test_exit();
 		if (rc < 0)
 			return 1;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index e6c43ba..8de3379 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -378,6 +378,7 @@ extern enum dcb_queue_mapping_mode dcb_q_mapping;
 extern uint16_t mbuf_data_size; /**< Mbuf data space size. */
 extern uint32_t param_total_num_mbufs;
 
+extern uint16_t stats_period;
 
 #ifdef RTE_LIBRTE_LATENCY_STATS
 extern uint8_t latencystats_enabled;
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 2a43214..bebe46a 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -188,6 +188,11 @@ The commandline options are:
 
     Start forwarding on initialization.
 
+*   ``-T PERIOD``
+
+    Display statistics every PERIOD seconds, if interactive mode is disabled.
+    The default value is 0, which means that the statistics will not be displayed.
+
 *   ``--nb-cores=N``
 
     Set the number of forwarding cores,
-- 
2.9.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH v3] app/testpmd: print statistics periodically
  2017-06-09  1:46 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
@ 2017-06-15  1:48   ` Pablo de Lara
  2017-06-19  1:05     ` Wu, Jingjing
                       ` (2 more replies)
  2017-06-19  0:54   ` [dpdk-dev] [PATCH v2] " Wu, Jingjing
  1 sibling, 3 replies; 18+ messages in thread
From: Pablo de Lara @ 2017-06-15  1:48 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, Pablo de Lara

Add parameter to print port statistics periodically
(disabled by default), if interactive mode is not enabled.

This is useful to allow the user to see port statistics
without having to get into the internal command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---

Changes in v3:

- Added missing "|" character in help

Changes in v2:

- Added extra argument in help 

 app/test-pmd/parameters.c             | 19 +++++++++++++++--
 app/test-pmd/testpmd.c                | 40 ++++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  5 +++++
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index fbe6284..41ed74c 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -88,7 +88,7 @@ usage(char* progname)
 	       "[--interactive|-i] "
 	       "[--cmdline-file=FILENAME] "
 #endif
-	       "[--help|-h] | [--auto-start|-a] | ["
+	       "[--help|-h] | [--auto-start|-a] | [-T PERIOD] | ["
 	       "--coremask=COREMASK --portmask=PORTMASK --numa "
 	       "--mbuf-size= | --total-num-mbufs= | "
 	       "--nb-cores= | --nb-ports= | "
@@ -109,6 +109,8 @@ usage(char* progname)
 	printf("  --auto-start: start forwarding on init "
 	       "[always when non-interactive].\n");
 	printf("  --help: display this message and quit.\n");
+	printf("  -T PERIOD: statistics will be shown every PERIOD seconds "
+	       "(only if interactive is disabled).\n");
 	printf("  --nb-cores=N: set the number of forwarding cores "
 	       "(1 <= N <= %d).\n", nb_lcores);
 	printf("  --nb-ports=N: set the number of forwarding ports "
@@ -639,7 +641,7 @@ launch_args_parse(int argc, char** argv)
 #else
 #define SHORTOPTS ""
 #endif
-	while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ah",
+	while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ahT:",
 				 lgopts, &opt_idx)) != EOF) {
 		switch (opt) {
 #ifdef RTE_LIBRTE_CMDLINE
@@ -653,6 +655,19 @@ launch_args_parse(int argc, char** argv)
 			auto_start = 1;
 			break;
 
+		case 'T':
+		{
+			char *end = NULL;
+			unsigned int n;
+
+			n = strtoul(optarg, &end, 10);
+			if ((optarg[0] == '\0') || (end == NULL) ||
+					(*end != '\0'))
+				break;
+
+			stats_period = n;
+			break;
+		}
 		case 0: /*long options */
 			if (!strcmp(lgopts[opt_idx].name, "help")) {
 				usage(argv[0]);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index d32cbb9..2e99b41 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -180,7 +180,7 @@ uint32_t burst_tx_retry_num = BURST_TX_RETRIES;
 uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */
 uint32_t param_total_num_mbufs = 0;  /**< number of mbufs in all pools - if
                                       * specified on command-line. */
-
+uint16_t stats_period; /**< Period to show statistics (disabled by default) */
 /*
  * Configuration of packet segments used by the "txonly" processing engine.
  */
@@ -2232,6 +2232,21 @@ force_quit(void)
 }
 
 static void
+print_stats(void)
+{
+	uint8_t i;
+	const char clr[] = { 27, '[', '2', 'J', '\0' };
+	const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };
+
+	/* Clear screen and move to top left */
+	printf("%s%s", clr, topLeft);
+
+	printf("\nPort statistics ====================================");
+	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
+		nic_stats_display(fwd_ports_ids[i]);
+}
+
+static void
 signal_handler(int signum)
 {
 	if (signum == SIGINT || signum == SIGTERM) {
@@ -2354,8 +2369,31 @@ main(int argc, char** argv)
 
 		printf("No commandline core given, start packet forwarding\n");
 		start_packet_forwarding(0);
+		if (stats_period != 0) {
+			uint64_t prev_tsc = 0, cur_tsc, timer_tsc = 0;
+			uint64_t timer_period;
+
+			/* Convert to number of cycles */
+			timer_period = stats_period * rte_get_timer_hz();
+
+			while (1) {
+				cur_tsc = rte_rdtsc();
+				timer_tsc += cur_tsc - prev_tsc;
+
+				if (timer_tsc >= timer_period) {
+					print_stats();
+					/* Reset the timer */
+					timer_tsc = 0;
+				}
+				/* Sleep to avoid unnecessary checks */
+				sleep(1);
+				prev_tsc = cur_tsc;
+			}
+		}
+
 		printf("Press enter to exit\n");
 		rc = read(0, &c, 1);
+
 		pmd_test_exit();
 		if (rc < 0)
 			return 1;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 364502d..bf9126c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -378,6 +378,7 @@ extern enum dcb_queue_mapping_mode dcb_q_mapping;
 extern uint16_t mbuf_data_size; /**< Mbuf data space size. */
 extern uint32_t param_total_num_mbufs;
 
+extern uint16_t stats_period;
 
 #ifdef RTE_LIBRTE_LATENCY_STATS
 extern uint8_t latencystats_enabled;
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 2a43214..bebe46a 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -188,6 +188,11 @@ The commandline options are:
 
     Start forwarding on initialization.
 
+*   ``-T PERIOD``
+
+    Display statistics every PERIOD seconds, if interactive mode is disabled.
+    The default value is 0, which means that the statistics will not be displayed.
+
 *   ``--nb-cores=N``
 
     Set the number of forwarding cores,
-- 
2.9.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/testpmd: print statistics periodically
  2017-06-09  1:46 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
  2017-06-15  1:48   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
@ 2017-06-19  0:54   ` Wu, Jingjing
  1 sibling, 0 replies; 18+ messages in thread
From: Wu, Jingjing @ 2017-06-19  0:54 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: dev



> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Friday, June 9, 2017 9:47 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [PATCH v2] app/testpmd: print statistics periodically
> 
> Add parameter to print port statistics periodically (disabled by default), if
> interactive mode is not enabled.
> 
> This is useful to allow the user to see port statistics without having to get into
> the internal command line.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
> 
> Changes in v2:
> 
> - Added extra argument in help
> 
Acked-by: Jingjing Wu <jingjing.wu@intel.com>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v3] app/testpmd: print statistics periodically
  2017-06-15  1:48   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
@ 2017-06-19  1:05     ` Wu, Jingjing
  2017-06-19 21:22     ` Thomas Monjalon
  2017-07-06  1:52     ` [dpdk-dev] [PATCH v4] " Pablo de Lara
  2 siblings, 0 replies; 18+ messages in thread
From: Wu, Jingjing @ 2017-06-19  1:05 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: dev



> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Thursday, June 15, 2017 9:48 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [PATCH v3] app/testpmd: print statistics periodically
> 
> Add parameter to print port statistics periodically (disabled by default), if
> interactive mode is not enabled.
> 
> This is useful to allow the user to see port statistics without having to get into
> the internal command line.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
> 
> Changes in v3:
> 
> - Added missing "|" character in help
Acked-by: Jingjing Wu <jingjing.wu@intel.com>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v3] app/testpmd: print statistics periodically
  2017-06-15  1:48   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
  2017-06-19  1:05     ` Wu, Jingjing
@ 2017-06-19 21:22     ` Thomas Monjalon
  2017-06-20  8:34       ` De Lara Guarch, Pablo
  2017-07-06  1:52     ` [dpdk-dev] [PATCH v4] " Pablo de Lara
  2 siblings, 1 reply; 18+ messages in thread
From: Thomas Monjalon @ 2017-06-19 21:22 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev, jingjing.wu

15/06/2017 03:48, Pablo de Lara:
> +print_stats(void)
> +{
> +	uint8_t i;
> +	const char clr[] = { 27, '[', '2', 'J', '\0' };
> +	const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };

Spotted a CamelCase ;)
Is there a punishment planned in the contributor's guide?

> +		if (stats_period != 0) {
> +			uint64_t prev_tsc = 0, cur_tsc, timer_tsc = 0;
> +			uint64_t timer_period;
> +
> +			/* Convert to number of cycles */
> +			timer_period = stats_period * rte_get_timer_hz();
> +
> +			while (1) {
> +				cur_tsc = rte_rdtsc();
> +				timer_tsc += cur_tsc - prev_tsc;

Please forget (Intel) TSC wording and prefer the more generic
rte_get_timer_cycles() function.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v3] app/testpmd: print statistics periodically
  2017-06-19 21:22     ` Thomas Monjalon
@ 2017-06-20  8:34       ` De Lara Guarch, Pablo
  2017-07-05 23:51         ` Thomas Monjalon
  0 siblings, 1 reply; 18+ messages in thread
From: De Lara Guarch, Pablo @ 2017-06-20  8:34 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Wu, Jingjing



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Monday, June 19, 2017 10:22 PM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org; Wu, Jingjing
> Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: print statistics
> periodically
> 
> 15/06/2017 03:48, Pablo de Lara:
> > +print_stats(void)
> > +{
> > +	uint8_t i;
> > +	const char clr[] = { 27, '[', '2', 'J', '\0' };
> > +	const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };
> 
> Spotted a CamelCase ;)
> Is there a punishment planned in the contributor's guide?

Sorry, got this from another app, will fix this.

> 
> > +		if (stats_period != 0) {
> > +			uint64_t prev_tsc = 0, cur_tsc, timer_tsc = 0;
> > +			uint64_t timer_period;
> > +
> > +			/* Convert to number of cycles */
> > +			timer_period = stats_period * rte_get_timer_hz();
> > +
> > +			while (1) {
> > +				cur_tsc = rte_rdtsc();
> > +				timer_tsc += cur_tsc - prev_tsc;
> 
> Please forget (Intel) TSC wording and prefer the more generic
> rte_get_timer_cycles() function.

Good point, will fix in the v4.

Thanks,
Pablo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v3] app/testpmd: print statistics periodically
  2017-06-20  8:34       ` De Lara Guarch, Pablo
@ 2017-07-05 23:51         ` Thomas Monjalon
  2017-07-06  9:56           ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Monjalon @ 2017-07-05 23:51 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: dev, Wu, Jingjing

20/06/2017 10:34, De Lara Guarch, Pablo:
> > > +		if (stats_period != 0) {
> > > +			uint64_t prev_tsc = 0, cur_tsc, timer_tsc = 0;
> > > +			uint64_t timer_period;
> > > +
> > > +			/* Convert to number of cycles */
> > > +			timer_period = stats_period * rte_get_timer_hz();
> > > +
> > > +			while (1) {
> > > +				cur_tsc = rte_rdtsc();
> > > +				timer_tsc += cur_tsc - prev_tsc;
> > 
> > Please forget (Intel) TSC wording and prefer the more generic
> > rte_get_timer_cycles() function.
> 
> Good point, will fix in the v4.

Waiting for v4.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH v4] app/testpmd: print statistics periodically
  2017-06-15  1:48   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
  2017-06-19  1:05     ` Wu, Jingjing
  2017-06-19 21:22     ` Thomas Monjalon
@ 2017-07-06  1:52     ` Pablo de Lara
  2017-07-06  3:05       ` [dpdk-dev] [PATCH v5] " Pablo de Lara
                         ` (2 more replies)
  2 siblings, 3 replies; 18+ messages in thread
From: Pablo de Lara @ 2017-07-06  1:52 UTC (permalink / raw)
  To: jingjing.wu, thomas; +Cc: dev, Pablo de Lara

Add parameter to print port statistics periodically
(disabled by default), if interactive mode is not enabled.

This is useful to allow the user to see port statistics
without having to get into the internal command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
---

Changes in v4:

- Removed CamelCase
- Used generic rte_get_timer_cycles() function, instead 
  of TSC API.

Changes in v3:

- Added missing "|" character in help

Changes in v2:

- Added extra argument in help 

 app/test-pmd/parameters.c             | 19 +++++++++++++++--
 app/test-pmd/testpmd.c                | 40 ++++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  5 +++++
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index fbe6284..41ed74c 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -88,7 +88,7 @@ usage(char* progname)
 	       "[--interactive|-i] "
 	       "[--cmdline-file=FILENAME] "
 #endif
-	       "[--help|-h] | [--auto-start|-a] | ["
+	       "[--help|-h] | [--auto-start|-a] | [-T PERIOD] | ["
 	       "--coremask=COREMASK --portmask=PORTMASK --numa "
 	       "--mbuf-size= | --total-num-mbufs= | "
 	       "--nb-cores= | --nb-ports= | "
@@ -109,6 +109,8 @@ usage(char* progname)
 	printf("  --auto-start: start forwarding on init "
 	       "[always when non-interactive].\n");
 	printf("  --help: display this message and quit.\n");
+	printf("  -T PERIOD: statistics will be shown every PERIOD seconds "
+	       "(only if interactive is disabled).\n");
 	printf("  --nb-cores=N: set the number of forwarding cores "
 	       "(1 <= N <= %d).\n", nb_lcores);
 	printf("  --nb-ports=N: set the number of forwarding ports "
@@ -639,7 +641,7 @@ launch_args_parse(int argc, char** argv)
 #else
 #define SHORTOPTS ""
 #endif
-	while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ah",
+	while ((opt = getopt_long(argc, argvopt, SHORTOPTS "ahT:",
 				 lgopts, &opt_idx)) != EOF) {
 		switch (opt) {
 #ifdef RTE_LIBRTE_CMDLINE
@@ -653,6 +655,19 @@ launch_args_parse(int argc, char** argv)
 			auto_start = 1;
 			break;
 
+		case 'T':
+		{
+			char *end = NULL;
+			unsigned int n;
+
+			n = strtoul(optarg, &end, 10);
+			if ((optarg[0] == '\0') || (end == NULL) ||
+					(*end != '\0'))
+				break;
+
+			stats_period = n;
+			break;
+		}
 		case 0: /*long options */
 			if (!strcmp(lgopts[opt_idx].name, "help")) {
 				usage(argv[0]);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 0a23d82..343b0f4 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -180,7 +180,7 @@ uint32_t burst_tx_retry_num = BURST_TX_RETRIES;
 uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */
 uint32_t param_total_num_mbufs = 0;  /**< number of mbufs in all pools - if
                                       * specified on command-line. */
-
+uint16_t stats_period; /**< Period to show statistics (disabled by default) */
 /*
  * Configuration of packet segments used by the "txonly" processing engine.
  */
@@ -2235,6 +2235,21 @@ force_quit(void)
 }
 
 static void
+print_stats(void)
+{
+	uint8_t i;
+	const char clr[] = { 27, '[', '2', 'J', '\0' };
+	const char top_left[] = { 27, '[', '1', ';', '1', 'H', '\0' };
+
+	/* Clear screen and move to top left */
+	printf("%s%s", clr, top_left);
+
+	printf("\nPort statistics ====================================");
+	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
+		nic_stats_display(fwd_ports_ids[i]);
+}
+
+static void
 signal_handler(int signum)
 {
 	if (signum == SIGINT || signum == SIGTERM) {
@@ -2357,8 +2372,31 @@ main(int argc, char** argv)
 
 		printf("No commandline core given, start packet forwarding\n");
 		start_packet_forwarding(0);
+		if (stats_period != 0) {
+			uint64_t prev_time = 0, cur_time, diff_time = 0;
+			uint64_t timer_period;
+
+			/* Convert to number of cycles */
+			timer_period = stats_period * rte_get_timer_hz();
+
+			while (1) {
+				cur_time = rte_get_timer_cycles();
+				diff_time += cur_time - prev_time;
+
+				if (diff_time >= timer_period) {
+					print_stats();
+					/* Reset the timer */
+					diff_time = 0;
+				}
+				/* Sleep to avoid unnecessary checks */
+				prev_time = cur_time;
+				sleep(1);
+			}
+		}
+
 		printf("Press enter to exit\n");
 		rc = read(0, &c, 1);
+
 		pmd_test_exit();
 		if (rc < 0)
 			return 1;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 364502d..bf9126c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -378,6 +378,7 @@ extern enum dcb_queue_mapping_mode dcb_q_mapping;
 extern uint16_t mbuf_data_size; /**< Mbuf data space size. */
 extern uint32_t param_total_num_mbufs;
 
+extern uint16_t stats_period;
 
 #ifdef RTE_LIBRTE_LATENCY_STATS
 extern uint8_t latencystats_enabled;
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 2a43214..bebe46a 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -188,6 +188,11 @@ The commandline options are:
 
     Start forwarding on initialization.
 
+*   ``-T PERIOD``
+
+    Display statistics every PERIOD seconds, if interactive mode is disabled.
+    The default value is 0, which means that the statistics will not be displayed.
+
 *   ``--nb-cores=N``
 
     Set the number of forwarding cores,
-- 
2.9.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [dpdk-dev] [PATCH v5] app/testpmd: print statistics periodically
  2017-07-06  1:52     ` [dpdk-dev] [PATCH v4] " Pablo de Lara
@ 2017-07-06  3:05       ` Pablo de Lara
  2017-07-06 14:20         ` Thomas Monjalon
  2017-07-06 10:06       ` [dpdk-dev] [PATCH v4] " Jerin Jacob
  2017-07-06 10:16       ` Thomas Monjalon
  2 siblings, 1 reply; 18+ messages in thread
From: Pablo de Lara @ 2017-07-06  3:05 UTC (permalink / raw)
  To: jingjing.wu, thomas; +Cc: dev, Pablo de Lara

Add parameter to print port statistics periodically
(disabled by default), if interactive mode is not enabled.

This is useful to allow the user to see port statistics
without having to get into the internal command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

---

Changes in v5:

- Rebased against dpdk master
- Modified parameter name from "T" to more explicit "stats-period"

Changes in v4:

- Removed CamelCase
- Used generic rte_get_timer_cycles() function, instead 
  of TSC API.

Changes in v3:

- Added missing "|" character in help

Changes in v2:

- Added extra argument in help 

 app/test-pmd/parameters.c             | 17 ++++++++++++++-
 app/test-pmd/testpmd.c                | 39 ++++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.h                |  1 +
 doc/guides/testpmd_app_ug/run_app.rst |  5 +++++
 4 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 0a88844..958b3d0 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -89,7 +89,7 @@ usage(char* progname)
 	       "[--cmdline-file=FILENAME] "
 #endif
 	       "[--help|-h] | [--auto-start|-a] | ["
-	       "--tx-first | "
+	       "--tx-first | --stats-period=PERIOD | "
 	       "--coremask=COREMASK --portmask=PORTMASK --numa "
 	       "--mbuf-size= | --total-num-mbufs= | "
 	       "--nb-cores= | --nb-ports= | "
@@ -112,6 +112,8 @@ usage(char* progname)
 	printf("  --help: display this message and quit.\n");
 	printf("  --tx-first: start forwarding sending a burst first "
 	       "(only if interactive is disabled).\n");
+	printf("  --stats-period=PERIOD: statistics will be shown "
+	       "every PERIOD seconds (only if interactive is disabled).\n");
 	printf("  --nb-cores=N: set the number of forwarding cores "
 	       "(1 <= N <= %d).\n", nb_lcores);
 	printf("  --nb-ports=N: set the number of forwarding ports "
@@ -570,6 +572,7 @@ launch_args_parse(int argc, char** argv)
 		{ "eth-peer",			1, 0, 0 },
 #endif
 		{ "tx-first",			0, 0, 0 },
+		{ "stats-period",		1, 0, 0 },
 		{ "ports",			1, 0, 0 },
 		{ "nb-cores",			1, 0, 0 },
 		{ "nb-ports",			1, 0, 0 },
@@ -683,6 +686,18 @@ launch_args_parse(int argc, char** argv)
 						"packets first\n");
 				tx_first = 1;
 			}
+			if (!strcmp(lgopts[opt_idx].name, "stats-period")) {
+				char *end = NULL;
+				unsigned int n;
+
+				n = strtoul(optarg, &end, 10);
+				if ((optarg[0] == '\0') || (end == NULL) ||
+						(*end != '\0'))
+					break;
+
+				stats_period = n;
+				break;
+			}
 			if (!strcmp(lgopts[opt_idx].name,
 				    "eth-peers-configfile")) {
 				if (init_peer_eth_addrs(optarg) != 0)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a7bad73..132ce81 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -181,7 +181,7 @@ uint32_t burst_tx_retry_num = BURST_TX_RETRIES;
 uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */
 uint32_t param_total_num_mbufs = 0;  /**< number of mbufs in all pools - if
                                       * specified on command-line. */
-
+uint16_t stats_period; /**< Period to show statistics (disabled by default) */
 /*
  * Configuration of packet segments used by the "txonly" processing engine.
  */
@@ -2236,6 +2236,21 @@ force_quit(void)
 }
 
 static void
+print_stats(void)
+{
+	uint8_t i;
+	const char clr[] = { 27, '[', '2', 'J', '\0' };
+	const char top_left[] = { 27, '[', '1', ';', '1', 'H', '\0' };
+
+	/* Clear screen and move to top left */
+	printf("%s%s", clr, top_left);
+
+	printf("\nPort statistics ====================================");
+	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
+		nic_stats_display(fwd_ports_ids[i]);
+}
+
+static void
 signal_handler(int signum)
 {
 	if (signum == SIGINT || signum == SIGTERM) {
@@ -2361,6 +2376,28 @@ main(int argc, char** argv)
 
 		printf("No commandline core given, start packet forwarding\n");
 		start_packet_forwarding(tx_first);
+		if (stats_period != 0) {
+			uint64_t prev_time = 0, cur_time, diff_time = 0;
+			uint64_t timer_period;
+
+			/* Convert to number of cycles */
+			timer_period = stats_period * rte_get_timer_hz();
+
+			while (1) {
+				cur_time = rte_get_timer_cycles();
+				diff_time += cur_time - prev_time;
+
+				if (diff_time >= timer_period) {
+					print_stats();
+					/* Reset the timer */
+					diff_time = 0;
+				}
+				/* Sleep to avoid unnecessary checks */
+				prev_time = cur_time;
+				sleep(1);
+			}
+		}
+
 		printf("Press enter to exit\n");
 		rc = read(0, &c, 1);
 		pmd_test_exit();
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 5cabeef..c73196f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -379,6 +379,7 @@ extern enum dcb_queue_mapping_mode dcb_q_mapping;
 extern uint16_t mbuf_data_size; /**< Mbuf data space size. */
 extern uint32_t param_total_num_mbufs;
 
+extern uint16_t stats_period;
 
 #ifdef RTE_LIBRTE_LATENCY_STATS
 extern uint8_t latencystats_enabled;
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 3159398..e50c47f 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -196,6 +196,11 @@ The commandline options are:
 
    This flag should be only used in non-interactive mode.
 
+*   ``--stats-period PERIOD``
+
+    Display statistics every PERIOD seconds, if interactive mode is disabled.
+    The default value is 0, which means that the statistics will not be displayed.
+
 *   ``--nb-cores=N``
 
     Set the number of forwarding cores,
-- 
2.9.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v3] app/testpmd: print statistics periodically
  2017-07-05 23:51         ` Thomas Monjalon
@ 2017-07-06  9:56           ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 18+ messages in thread
From: De Lara Guarch, Pablo @ 2017-07-06  9:56 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Wu, Jingjing



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Thursday, July 6, 2017 12:52 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: print statistics
> periodically
> 
> 20/06/2017 10:34, De Lara Guarch, Pablo:
> > > > +		if (stats_period != 0) {
> > > > +			uint64_t prev_tsc = 0, cur_tsc, timer_tsc = 0;
> > > > +			uint64_t timer_period;
> > > > +
> > > > +			/* Convert to number of cycles */
> > > > +			timer_period = stats_period * rte_get_timer_hz();
> > > > +
> > > > +			while (1) {
> > > > +				cur_tsc = rte_rdtsc();
> > > > +				timer_tsc += cur_tsc - prev_tsc;
> > >
> > > Please forget (Intel) TSC wording and prefer the more generic
> > > rte_get_timer_cycles() function.
> >
> > Good point, will fix in the v4.
> 
> Waiting for v4.

Just sent it, sorry for the delay.

Pablo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v4] app/testpmd: print statistics periodically
  2017-07-06  1:52     ` [dpdk-dev] [PATCH v4] " Pablo de Lara
  2017-07-06  3:05       ` [dpdk-dev] [PATCH v5] " Pablo de Lara
@ 2017-07-06 10:06       ` Jerin Jacob
  2017-07-06 10:43         ` De Lara Guarch, Pablo
  2017-07-06 10:16       ` Thomas Monjalon
  2 siblings, 1 reply; 18+ messages in thread
From: Jerin Jacob @ 2017-07-06 10:06 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: jingjing.wu, thomas, dev

-----Original Message-----
> Date: Thu, 6 Jul 2017 02:52:05 +0100
> From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> To: jingjing.wu@intel.com, thomas@monjalon.net
> CC: dev@dpdk.org, Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Subject: [dpdk-dev] [PATCH v4] app/testpmd: print statistics periodically
> X-Mailer: git-send-email 2.9.4
> 
> Add parameter to print port statistics periodically
> (disabled by default), if interactive mode is not enabled.
> 
> This is useful to allow the user to see port statistics
> without having to get into the internal command line.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> ---
> 
> Changes in v4:
> 
> - Removed CamelCase
> - Used generic rte_get_timer_cycles() function, instead 
>   of TSC API.
> 
> Changes in v3:
> 
> - Added missing "|" character in help
> 
> Changes in v2:
> 
> - Added extra argument in help 
> 
>  app/test-pmd/parameters.c             | 19 +++++++++++++++--
>  app/test-pmd/testpmd.c                | 40 ++++++++++++++++++++++++++++++++++-
>  app/test-pmd/testpmd.h                |  1 +
>  doc/guides/testpmd_app_ug/run_app.rst |  5 +++++
>  4 files changed, 62 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> index fbe6284..41ed74c 100644
> --- a/app/test-pmd/parameters.c
> +++ b/app/test-pmd/parameters.c
> @@ -88,7 +88,7 @@ usage(char* progname)
>  	       "[--interactive|-i] "
>  	       "[--cmdline-file=FILENAME] "
>  #endif
> -	       "[--help|-h] | [--auto-start|-a] | ["
> +	       "[--help|-h] | [--auto-start|-a] | [-T PERIOD] | ["
>  	       "--coremask=COREMASK --portmask=PORTMASK --numa "
>  	       "--mbuf-size= | --total-num-mbufs= | "
>  	       "--nb-cores= | --nb-ports= | "
> @@ -109,6 +109,8 @@ usage(char* progname)
>  	printf("  --auto-start: start forwarding on init "
>  	       "[always when non-interactive].\n");
>  	printf("  --help: display this message and quit.\n");
> +	printf("  -T PERIOD: statistics will be shown every PERIOD seconds "

Considering all the option are in small letter, Does it makes sense to
make it as small letter? (ie -t instead of -T).

Other than it looks good and useful feature.

Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v4] app/testpmd: print statistics periodically
  2017-07-06  1:52     ` [dpdk-dev] [PATCH v4] " Pablo de Lara
  2017-07-06  3:05       ` [dpdk-dev] [PATCH v5] " Pablo de Lara
  2017-07-06 10:06       ` [dpdk-dev] [PATCH v4] " Jerin Jacob
@ 2017-07-06 10:16       ` Thomas Monjalon
  2017-07-06 10:19         ` De Lara Guarch, Pablo
  2 siblings, 1 reply; 18+ messages in thread
From: Thomas Monjalon @ 2017-07-06 10:16 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: jingjing.wu, dev

06/07/2017 03:52, Pablo de Lara:
> Add parameter to print port statistics periodically
> (disabled by default), if interactive mode is not enabled.
> 
> This is useful to allow the user to see port statistics
> without having to get into the internal command line.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> ---
> 
> Changes in v4:
> 
> - Removed CamelCase
> - Used generic rte_get_timer_cycles() function, instead 
>   of TSC API.

Thank you for the update.
Please, may I request a v5 rebased on current master?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v4] app/testpmd: print statistics periodically
  2017-07-06 10:16       ` Thomas Monjalon
@ 2017-07-06 10:19         ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 18+ messages in thread
From: De Lara Guarch, Pablo @ 2017-07-06 10:19 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Wu, Jingjing, dev



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Thursday, July 6, 2017 11:16 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org
> Subject: Re: [PATCH v4] app/testpmd: print statistics periodically
> 
> 06/07/2017 03:52, Pablo de Lara:
> > Add parameter to print port statistics periodically (disabled by
> > default), if interactive mode is not enabled.
> >
> > This is useful to allow the user to see port statistics without having
> > to get into the internal command line.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> > ---
> >
> > Changes in v4:
> >
> > - Removed CamelCase
> > - Used generic rte_get_timer_cycles() function, instead
> >   of TSC API.
> 
> Thank you for the update.
> Please, may I request a v5 rebased on current master?

Oh... sure, sorry about that. Will send a v5, and probably change the parameter name,
as per Jerin's request.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v4] app/testpmd: print statistics periodically
  2017-07-06 10:06       ` [dpdk-dev] [PATCH v4] " Jerin Jacob
@ 2017-07-06 10:43         ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 18+ messages in thread
From: De Lara Guarch, Pablo @ 2017-07-06 10:43 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Wu, Jingjing, thomas, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> Sent: Thursday, July 6, 2017 11:07 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; thomas@monjalon.net;
> dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4] app/testpmd: print statistics
> periodically
> 
> -----Original Message-----
> > Date: Thu, 6 Jul 2017 02:52:05 +0100
> > From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > To: jingjing.wu@intel.com, thomas@monjalon.net
> > CC: dev@dpdk.org, Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > Subject: [dpdk-dev] [PATCH v4] app/testpmd: print statistics
> > periodically
> > X-Mailer: git-send-email 2.9.4
> >
> > Add parameter to print port statistics periodically (disabled by
> > default), if interactive mode is not enabled.
> >
> > This is useful to allow the user to see port statistics without having
> > to get into the internal command line.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> > ---
> >
> > Changes in v4:
> >
> > - Removed CamelCase
> > - Used generic rte_get_timer_cycles() function, instead
> >   of TSC API.
> >
> > Changes in v3:
> >
> > - Added missing "|" character in help
> >
> > Changes in v2:
> >
> > - Added extra argument in help
> >
> >  app/test-pmd/parameters.c             | 19 +++++++++++++++--
> >  app/test-pmd/testpmd.c                | 40
> ++++++++++++++++++++++++++++++++++-
> >  app/test-pmd/testpmd.h                |  1 +
> >  doc/guides/testpmd_app_ug/run_app.rst |  5 +++++
> >  4 files changed, 62 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> > index fbe6284..41ed74c 100644
> > --- a/app/test-pmd/parameters.c
> > +++ b/app/test-pmd/parameters.c
> > @@ -88,7 +88,7 @@ usage(char* progname)
> >  	       "[--interactive|-i] "
> >  	       "[--cmdline-file=FILENAME] "
> >  #endif
> > -	       "[--help|-h] | [--auto-start|-a] | ["
> > +	       "[--help|-h] | [--auto-start|-a] | [-T PERIOD] | ["
> >  	       "--coremask=COREMASK --portmask=PORTMASK --numa "
> >  	       "--mbuf-size= | --total-num-mbufs= | "
> >  	       "--nb-cores= | --nb-ports= | "
> > @@ -109,6 +109,8 @@ usage(char* progname)
> >  	printf("  --auto-start: start forwarding on init "
> >  	       "[always when non-interactive].\n");
> >  	printf("  --help: display this message and quit.\n");
> > +	printf("  -T PERIOD: statistics will be shown every PERIOD seconds "
> 
> Considering all the option are in small letter, Does it makes sense to make it
> as small letter? (ie -t instead of -T).
> 
> Other than it looks good and useful feature.
> 
> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Thanks for the testing. I took the parameter name from L2fwd, but you are right,
it should be lowercase. Actually, to make it more explicit, I propose 
to change it to "--stats-period".

Will send a v5 soon.
Thanks,
Pablo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [dpdk-dev] [PATCH v5] app/testpmd: print statistics periodically
  2017-07-06  3:05       ` [dpdk-dev] [PATCH v5] " Pablo de Lara
@ 2017-07-06 14:20         ` Thomas Monjalon
  0 siblings, 0 replies; 18+ messages in thread
From: Thomas Monjalon @ 2017-07-06 14:20 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev, jingjing.wu

06/07/2017 05:05, Pablo de Lara:
> Add parameter to print port statistics periodically
> (disabled by default), if interactive mode is not enabled.
> 
> This is useful to allow the user to see port statistics
> without having to get into the internal command line.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-07-06 14:20 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-28 21:38 [dpdk-dev] [PATCH] app/testpmd: print statistics periodically Pablo de Lara
2017-06-07  9:11 ` Wu, Jingjing
2017-06-07 13:13   ` De Lara Guarch, Pablo
2017-06-09  1:46 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
2017-06-15  1:48   ` [dpdk-dev] [PATCH v3] " Pablo de Lara
2017-06-19  1:05     ` Wu, Jingjing
2017-06-19 21:22     ` Thomas Monjalon
2017-06-20  8:34       ` De Lara Guarch, Pablo
2017-07-05 23:51         ` Thomas Monjalon
2017-07-06  9:56           ` De Lara Guarch, Pablo
2017-07-06  1:52     ` [dpdk-dev] [PATCH v4] " Pablo de Lara
2017-07-06  3:05       ` [dpdk-dev] [PATCH v5] " Pablo de Lara
2017-07-06 14:20         ` Thomas Monjalon
2017-07-06 10:06       ` [dpdk-dev] [PATCH v4] " Jerin Jacob
2017-07-06 10:43         ` De Lara Guarch, Pablo
2017-07-06 10:16       ` Thomas Monjalon
2017-07-06 10:19         ` De Lara Guarch, Pablo
2017-06-19  0:54   ` [dpdk-dev] [PATCH v2] " Wu, Jingjing

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).