From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 62309A0C4C; Thu, 14 Oct 2021 11:54:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F0E0041245; Thu, 14 Oct 2021 11:53:40 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id A1F2841208 for ; Thu, 14 Oct 2021 11:53:34 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="227927754" X-IronPort-AV: E=Sophos;i="5.85,372,1624345200"; d="scan'208";a="227927754" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2021 02:53:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,372,1624345200"; d="scan'208";a="491882231" Received: from silpixa00401122.ir.intel.com ([10.55.128.10]) by orsmga008.jf.intel.com with ESMTP; 14 Oct 2021 02:53:20 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, fengchengwen@huawei.com, conor.walsh@intel.com, Kevin Laatz Date: Thu, 14 Oct 2021 09:53:07 +0000 Message-Id: <20211014095311.1311617-5-kevin.laatz@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211014095311.1311617-1-kevin.laatz@intel.com> References: <20210910172737.2561156-1-kevin.laatz@intel.com> <20211014095311.1311617-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 4/8] examples/ioat: add cmd line option to control stats print interval X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add a command line option to control the interval between stats prints. Signed-off-by: Kevin Laatz Reviewed-by: Conor Walsh --- 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 .//examples/dpdk-ioat [EAL options] -- [-p MASK] [-q NQ] [-s RS] [-c ] - [--[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