DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, fengchengwen@huawei.com,
	conor.walsh@intel.com, Kevin Laatz <kevin.laatz@intel.com>
Subject: [dpdk-dev] [PATCH v4 4/8] examples/ioat: add cmd line option to control stats print interval
Date: Thu, 14 Oct 2021 09:53:07 +0000	[thread overview]
Message-ID: <20211014095311.1311617-5-kevin.laatz@intel.com> (raw)
In-Reply-To: <20211014095311.1311617-1-kevin.laatz@intel.com>

Add a command line option to control the interval between stats prints.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
---
 doc/guides/sample_app_ug/ioat.rst |  4 +++-
 examples/ioat/ioatfwd.c           | 31 +++++++++++++++++++++++--------
 2 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/doc/guides/sample_app_ug/ioat.rst b/doc/guides/sample_app_ug/ioat.rst
index 127129dd4b..1edad3f9ac 100644
--- a/doc/guides/sample_app_ug/ioat.rst
+++ b/doc/guides/sample_app_ug/ioat.rst
@@ -46,7 +46,7 @@ The application requires a number of command line options:
 .. code-block:: console
 
     ./<build_dir>/examples/dpdk-ioat [EAL options] -- [-p MASK] [-q NQ] [-s RS] [-c <sw|hw>]
-        [--[no-]mac-updating] [-b BS] [-f FS]
+        [--[no-]mac-updating] [-b BS] [-f FS] [-i SI]
 
 where,
 
@@ -68,6 +68,8 @@ where,
 
 *   f FS: set the max frame size
 
+*   i SI: set the interval, in second, between statistics prints (default is 1)
+
 The application can be launched in various configurations depending on
 provided parameters. The app can use up to 2 lcores: one of them receives
 incoming traffic and makes a copy of each packet. The second lcore then
diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 04ed175432..8c4920b798 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -26,6 +26,7 @@
 #define CMD_LINE_OPT_RING_SIZE "ring-size"
 #define CMD_LINE_OPT_BATCH_SIZE "dma-batch-size"
 #define CMD_LINE_OPT_FRAME_SIZE "max-frame-size"
+#define CMD_LINE_OPT_STATS_INTERVAL "stats-interval"
 
 /* configurable number of RX/TX ring descriptors */
 #define RX_DEFAULT_RINGSIZE 1024
@@ -95,6 +96,9 @@ static copy_mode_t copy_mode = COPY_MODE_IOAT_NUM;
  */
 static unsigned short ring_size = 2048;
 
+/* interval, in seconds, between stats prints */
+static unsigned short stats_interval = 1;
+
 /* global transmission config */
 struct rxtx_transmission_config cfg;
 
@@ -152,15 +156,15 @@ print_total_stats(struct total_statistics *ts)
 		"\nTotal packets Tx: %24"PRIu64" [pps]"
 		"\nTotal packets Rx: %24"PRIu64" [pps]"
 		"\nTotal packets dropped: %19"PRIu64" [pps]",
-		ts->total_packets_tx,
-		ts->total_packets_rx,
-		ts->total_packets_dropped);
+		ts->total_packets_tx / stats_interval,
+		ts->total_packets_rx / stats_interval,
+		ts->total_packets_dropped / stats_interval);
 
 	if (copy_mode == COPY_MODE_IOAT_NUM) {
 		printf("\nTotal IOAT successful enqueues: %8"PRIu64" [enq/s]"
 			"\nTotal IOAT failed enqueues: %12"PRIu64" [enq/s]",
-			ts->total_successful_enqueues,
-			ts->total_failed_enqueues);
+			ts->total_successful_enqueues / stats_interval,
+			ts->total_failed_enqueues / stats_interval);
 	}
 
 	printf("\n====================================================\n");
@@ -248,10 +252,10 @@ print_stats(char *prgname)
 	memset(&ts, 0, sizeof(struct total_statistics));
 
 	while (!force_quit) {
-		/* Sleep for 1 second each round - init sleep allows reading
+		/* Sleep for "stats_interval" seconds each round - init sleep allows reading
 		 * messages from app startup.
 		 */
-		sleep(1);
+		sleep(stats_interval);
 
 		/* Clear screen and move to top left */
 		printf("%s%s", clr, topLeft);
@@ -614,7 +618,8 @@ ioat_usage(const char *prgname)
 		"       - The source MAC address is replaced by the TX port MAC address\n"
 		"       - The destination MAC address is replaced by 02:00:00:00:00:TX_PORT_ID\n"
 		"  -c --copy-type CT: type of copy: sw|hw\n"
-		"  -s --ring-size RS: size of IOAT rawdev ring for hardware copy mode or rte_ring for software copy mode\n",
+		"  -s --ring-size RS: size of IOAT rawdev ring for hardware copy mode or rte_ring for software copy mode\n"
+		"  -i --stats-interval SI: interval, in seconds, between stats prints (default is 1)\n",
 			prgname);
 }
 
@@ -654,6 +659,7 @@ ioat_parse_args(int argc, char **argv, unsigned int nb_ports)
 		"p:"  /* portmask */
 		"q:"  /* number of RX queues per port */
 		"s:"  /* ring size */
+		"i:"  /* interval, in seconds, between stats prints */
 		;
 
 	static const struct option lgopts[] = {
@@ -665,6 +671,7 @@ ioat_parse_args(int argc, char **argv, unsigned int nb_ports)
 		{CMD_LINE_OPT_RING_SIZE, required_argument, NULL, 's'},
 		{CMD_LINE_OPT_BATCH_SIZE, required_argument, NULL, 'b'},
 		{CMD_LINE_OPT_FRAME_SIZE, required_argument, NULL, 'f'},
+		{CMD_LINE_OPT_STATS_INTERVAL, required_argument, NULL, 'i'},
 		{NULL, 0, 0, 0}
 	};
 
@@ -738,6 +745,14 @@ ioat_parse_args(int argc, char **argv, unsigned int nb_ports)
 			}
 			break;
 
+		case 'i':
+			stats_interval = atoi(optarg);
+			if (stats_interval == 0) {
+				printf("Invalid stats interval, setting to 1\n");
+				stats_interval = 1;	/* set to default */
+			}
+			break;
+
 		/* long options */
 		case 0:
 			break;
-- 
2.30.2


  parent reply	other threads:[~2021-10-14  9:54 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 17:27 [dpdk-dev] [PATCH 0/6] port ioatfwd app to dmadev Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 1/6] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 2/6] examples/ioat: add cmd-line option to control DMA batch size Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 3/6] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 4/6] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 5/6] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 6/6] examples/ioat: rename application to dmafwd Kevin Laatz
2021-09-17 16:41 ` [dpdk-dev] [PATCH v2 0/6] port ioatfwd app to dmadev Kevin Laatz
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 1/6] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-09-20 11:24     ` Conor Walsh
2021-09-23 15:33       ` Kevin Laatz
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 2/6] examples/ioat: add cmd-line option to control DMA batch size Kevin Laatz
2021-09-20 11:24     ` Conor Walsh
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 3/6] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-09-20 11:24     ` Conor Walsh
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 4/6] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-09-20 11:25     ` Conor Walsh
2021-09-24  4:00     ` fengchengwen
2021-09-24  8:40       ` Kevin Laatz
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 5/6] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-09-20 11:25     ` Conor Walsh
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 6/6] examples/ioat: rename application to dmafwd Kevin Laatz
2021-09-20 11:25     ` Conor Walsh
2021-09-23 13:53   ` [dpdk-dev] [PATCH v2 0/6] port ioatfwd app to dmadev fengchengwen
2021-09-23 14:00     ` Kevin Laatz
2021-09-28 16:29 ` [dpdk-dev] [PATCH v3 0/8] " Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 1/8] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 2/8] examples/ioat: add cmd line option to control DMA batch size Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 3/8] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 4/8] examples/ioat: add cmd line option to control stats print interval Kevin Laatz
2021-09-29 10:32     ` Conor Walsh
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 5/8] examples/ioat: add signal-triggered device dumps Kevin Laatz
2021-09-29 10:33     ` Conor Walsh
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 6/8] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 7/8] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 8/8] examples/ioat: rename application to dmafwd Kevin Laatz
2021-10-14  9:53 ` [dpdk-dev] [PATCH v4 0/8] port ioatfwd app to dmadev Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 1/8] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 2/8] examples/ioat: add cmd line option to control DMA batch size Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 3/8] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-10-14  9:53   ` Kevin Laatz [this message]
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 5/8] examples/ioat: add signal-triggered device dumps Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 6/8] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 7/8] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 8/8] examples/ioat: rename application to dmafwd Kevin Laatz
2021-10-22 19:48   ` [dpdk-dev] [PATCH v4 0/8] port ioatfwd app to dmadev Thomas Monjalon
2021-10-25 19:59     ` Kevin Laatz
2021-10-26  0:56   ` fengchengwen
2021-10-26 11:46     ` Kevin Laatz
2021-10-26 13:14 ` [dpdk-dev] [PATCH v5 " Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 1/8] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 2/8] examples/ioat: add cmd line option to control DMA batch size Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 3/8] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 4/8] examples/ioat: add cmd line option to control stats print interval Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 5/8] examples/ioat: add signal-triggered device dumps Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 6/8] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 7/8] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 8/8] examples/ioat: rename application to dmafwd Kevin Laatz
2021-10-27 13:23   ` [dpdk-dev] [PATCH v5 0/8] port ioatfwd app to dmadev Thomas Monjalon
2021-10-27 13:35     ` Kevin Laatz
2021-10-27 14:07       ` Thomas Monjalon
2021-10-27 14:14         ` Kevin Laatz
2021-10-27 14:54   ` 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=20211014095311.1311617-5-kevin.laatz@intel.com \
    --to=kevin.laatz@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=conor.walsh@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.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).