DPDK patches and discussions
 help / color / mirror / Atom feed
From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Cc: Harry van Haaren <harry.van.haaren@intel.com>,
	Thomas Monjalon <thomas.monjalon@6wind.com>,
	Reshma Pattan <reshma.pattan@intel.com>
Subject: [dpdk-dev] [PATCH v9 7/7] app/test-pmd: add latency statistics calculation
Date: Wed, 18 Jan 2017 15:05:43 +0000	[thread overview]
Message-ID: <1484751943-22877-8-git-send-email-remy.horton@intel.com> (raw)
In-Reply-To: <1484751943-22877-1-git-send-email-remy.horton@intel.com>

From: Harry van Haaren <harry.van.haaren@intel.com>

This patch adds latency stats commandline argument to testpmd,
allowing to specify the lcore to use for latencystats updates.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 app/test-pmd/parameters.c | 20 +++++++++++++++++++-
 app/test-pmd/testpmd.c    | 37 +++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h    |  6 +++++-
 3 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 28db8cd..30b60ba 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -149,6 +149,10 @@ usage(char* progname)
 	       "the packet will be enqueued into the rx drop-queue. "
 	       "If the drop-queue doesn't exist, the packet is dropped. "
 	       "By default drop-queue=127.\n");
+#ifdef RTE_LIBRTE_LATENCY_STATS
+	printf("  --latencystats=N: enable latency and jitter statistcs "
+	       "monitoring on lcore id N.\n");
+#endif
 	printf("  --crc-strip: enable CRC stripping by hardware.\n");
 	printf("  --enable-lro: enable large receive offload.\n");
 	printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
@@ -526,6 +530,7 @@ launch_args_parse(int argc, char** argv)
 		{ "pkt-filter-report-hash",     1, 0, 0 },
 		{ "pkt-filter-size",            1, 0, 0 },
 		{ "pkt-filter-drop-queue",      1, 0, 0 },
+		{ "latencystats",               1, 0, 0 },
 		{ "crc-strip",                  0, 0, 0 },
 		{ "enable-lro",                 0, 0, 0 },
 		{ "enable-rx-cksum",            0, 0, 0 },
@@ -766,6 +771,19 @@ launch_args_parse(int argc, char** argv)
 						 "drop queue %d invalid - must"
 						 "be >= 0 \n", n);
 			}
+#ifdef RTE_LIBRTE_LATENCY_STATS
+			if (!strcmp(lgopts[opt_idx].name,
+				    "latencystats")) {
+				n = atoi(optarg);
+				if (n >= 0) {
+					latencystats_lcore_id = (lcoreid_t) n;
+					latencystats_enabled = 1;
+				} else
+					rte_exit(EXIT_FAILURE,
+						 "invalid lcore id %d for latencystats"
+						 " must be >= 0\n", n);
+			}
+#endif
 			if (!strcmp(lgopts[opt_idx].name, "crc-strip"))
 				rx_mode.hw_strip_crc = 1;
 			if (!strcmp(lgopts[opt_idx].name, "enable-lro"))
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index b31a300..524e758 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"
 
@@ -276,6 +280,20 @@ uint32_t bypass_timeout = RTE_BYPASS_TMT_OFF;
 
 #endif
 
+#ifdef RTE_LIBRTE_LATENCY_STATS
+
+/*
+ * Set when latency stats is enabled in the commandline
+ */
+uint8_t latencystats_enabled;
+
+/*
+ * Lcore ID to serive latency statistics.
+ */
+lcoreid_t latencystats_lcore_id = -1;
+
+#endif
+
 /*
  * Ethernet device configuration.
  */
@@ -955,6 +973,11 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 			tics_datum = tics_current;
 		}
 #endif
+#ifdef RTE_LIBRTE_LATENCY_STATS
+		if (latencystats_lcore_id == rte_lcore_id())
+			rte_latencystats_update();
+#endif
+
 	} while (! fc->stopped);
 }
 
@@ -2108,6 +2131,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);
@@ -2169,6 +2195,17 @@ main(int argc, char** argv)
 	/* Init metrics library */
 	rte_metrics_init(rte_socket_id());
 
+#ifdef RTE_LIBRTE_LATENCY_STATS
+	if (latencystats_enabled != 0) {
+		int ret = rte_latencystats_init(1, NULL);
+		if (ret)
+			printf("Warning: latencystats init()"
+				" returned error %d\n",	ret);
+		printf("Latencystats running on lcore %d\n",
+			latencystats_lcore_id);
+	}
+#endif
+
 	/* Setup bitrate stats */
 #ifdef RTE_LIBRTE_BITRATE
 	bitrate_data = rte_stats_bitrate_create();
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 0a9a1af..35f7477 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -381,6 +381,10 @@ 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 uint8_t latencystats_enabled;
+extern lcoreid_t latencystats_lcore_id;
+
 extern struct rte_fdir_conf fdir_conf;
 
 /*
-- 
2.5.5

  parent reply	other threads:[~2017-01-18 15:05 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24 14:58 [dpdk-dev] [RFC PATCH v1] rte: add bit-rate metrics to xstats Remy Horton
2016-08-26 13:28 ` Pattan, Reshma
2016-08-29 10:01 ` Pattan, Reshma
2016-08-29 11:19   ` Remy Horton
2016-10-28  1:04 ` [dpdk-dev] [PATCH v2 0/3] expanded statistic reporting Remy Horton
2016-10-28  1:04   ` [dpdk-dev] [RFC PATCH v2 1/3] lib: add information metrics library Remy Horton
2016-10-28  1:04   ` [dpdk-dev] [RFC PATCH v2 2/3] lib: add bitrate statistics library Remy Horton
2016-10-28  1:12     ` Stephen Hemminger
2016-10-28  7:48       ` Remy Horton
2016-10-28  7:39     ` Morten Brørup
2016-11-01  1:53       ` Remy Horton
2016-10-28  1:04   ` [dpdk-dev] [RFC PATCH v2 3/3] app/test-pmd: add support for bitrate statistics Remy Horton
2016-11-04  3:36   ` [dpdk-dev] [PATCH v3 0/3] Expanded statistics reporting Remy Horton
2016-11-04  3:36     ` [dpdk-dev] [PATCH v3 1/3] lib: add information metrics library Remy Horton
2016-11-04 16:42       ` Pattan, Reshma
2016-11-07 15:25         ` Pattan, Reshma
2016-11-08  3:19           ` Remy Horton
2016-11-04  3:36     ` [dpdk-dev] [PATCH v3 2/3] lib: add bitrate statistics library Remy Horton
2016-11-04  3:36     ` [dpdk-dev] [PATCH v3 3/3] app/test-pmd: add support for bitrate statistics Remy Horton
2016-11-15  7:15     ` [dpdk-dev] [PATCH v4 0/3] Expanded statistics reporting Remy Horton
2016-11-15  7:15       ` [dpdk-dev] [PATCH v4 1/3] lib: add information metrics library Remy Horton
2016-11-15  7:15       ` [dpdk-dev] [PATCH v4 2/3] lib: add bitrate statistics library Remy Horton
2016-11-15 15:17         ` Pattan, Reshma
2016-11-15  7:15       ` [dpdk-dev] [PATCH v4 3/3] app/test-pmd: add support for bitrate statistics Remy Horton
2016-11-18  8:00       ` [dpdk-dev] [PATCH v5 0/4] Expanded statistics reporting Remy Horton
2016-11-18  8:00         ` [dpdk-dev] [PATCH v5 1/4] lib: add information metrics library Remy Horton
2016-11-18  8:00         ` [dpdk-dev] [PATCH v5 2/4] lib: add bitrate statistics library Remy Horton
2016-11-18  8:00         ` [dpdk-dev] [PATCH v5 3/4] app/test-pmd: add support for bitrate statistics Remy Horton
2016-11-18  8:00         ` [dpdk-dev] [PATCH v5 4/4] latencystats: added new library for latency stats Remy Horton
2017-01-11 16:03         ` [dpdk-dev] [PATCH v6 0/4] Expanded statistics reporting Remy Horton
2017-01-11 16:03           ` [dpdk-dev] [PATCH v6 1/4] lib: add information metrics library Remy Horton
2017-01-12 13:22             ` Thomas Monjalon
2017-01-12 15:30               ` Remy Horton
2017-01-12 19:05                 ` Thomas Monjalon
2017-01-16 10:27                   ` Remy Horton
2017-01-11 16:03           ` [dpdk-dev] [PATCH v6 2/4] lib: add bitrate statistics library Remy Horton
2017-01-11 16:15             ` Stephen Hemminger
2017-01-16 13:18               ` Remy Horton
2017-01-11 16:03           ` [dpdk-dev] [PATCH v6 3/4] app/test-pmd: add support for bitrate statistics Remy Horton
2017-01-12 13:32             ` Thomas Monjalon
2017-01-11 16:03           ` [dpdk-dev] [PATCH v6 4/4] latencystats: added new library for latency stats Remy Horton
2017-01-12 13:41             ` Thomas Monjalon
2017-01-12 14:44               ` Remy Horton
2017-01-13  9:45               ` Mcnamara, John
2017-01-13  9:53                 ` Thomas Monjalon
2017-01-16 16:18                   ` Mcnamara, John
2017-01-11 16:58           ` [dpdk-dev] [PATCH v6 0/4] Expanded statistics reporting Thomas Monjalon
2017-01-16 16:19           ` [dpdk-dev] [PATCH v7 0/6] " Remy Horton
2017-01-16 16:19             ` [dpdk-dev] [PATCH v7 1/6] lib: add information metrics library Remy Horton
2017-01-17 11:01               ` Van Haaren, Harry
2017-01-17 13:40                 ` Remy Horton
2017-01-17 14:23                   ` Van Haaren, Harry
2017-01-16 16:19             ` [dpdk-dev] [PATCH v7 2/6] app/proc_info: add metrics displaying Remy Horton
2017-01-17 11:08               ` Van Haaren, Harry
2017-01-17 14:27                 ` Remy Horton
2017-01-16 16:19             ` [dpdk-dev] [PATCH v7 3/6] lib: add bitrate statistics library Remy Horton
2017-01-17 11:16               ` Van Haaren, Harry
2017-01-17 15:37                 ` Remy Horton
2017-01-16 16:19             ` [dpdk-dev] [PATCH v7 4/6] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-01-17 11:19               ` Van Haaren, Harry
2017-01-16 16:19             ` [dpdk-dev] [PATCH v7 5/6] lib: added new library for latency stats Remy Horton
2017-01-17  4:29               ` Jerin Jacob
2017-01-17  6:48                 ` Remy Horton
2017-01-17  7:35                   ` Jerin Jacob
2017-01-17 11:19                 ` Mcnamara, John
2017-01-17 12:34                   ` Jerin Jacob
2017-01-17 14:53                     ` Mcnamara, John
2017-01-17 16:25                       ` Jerin Jacob
2017-01-18 20:11                         ` Olivier Matz
2017-01-24 15:24                           ` Olivier MATZ
2017-01-17 11:41               ` Van Haaren, Harry
2017-01-16 16:19             ` [dpdk-dev] [PATCH v7 6/6] app/test-pmd: add latency statistics calculation Remy Horton
2017-01-17 11:45               ` Van Haaren, Harry
2017-01-17 23:24             ` [dpdk-dev] [PATCH v8 0/7] Expanded statistics reporting Remy Horton
2017-01-17 23:24               ` [dpdk-dev] [PATCH v8 1/7] lib: add information metrics library Remy Horton
2017-01-17 23:24               ` [dpdk-dev] [PATCH v8 2/7] app/proc_info: add metrics displaying Remy Horton
2017-01-17 23:24               ` [dpdk-dev] [PATCH v8 3/7] lib: add bitrate statistics library Remy Horton
2017-01-17 23:24               ` [dpdk-dev] [PATCH v8 4/7] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-01-17 23:24               ` [dpdk-dev] [PATCH v8 5/7] mbuf: add a timestamp to the mbuf for latencystats Remy Horton
2017-01-17 23:24               ` [dpdk-dev] [PATCH v8 6/7] lib: added new library for latency stats Remy Horton
2017-01-17 23:24               ` [dpdk-dev] [PATCH v8 7/7] app/test-pmd: add latency statistics calculation Remy Horton
2017-01-18 15:05               ` [dpdk-dev] [PATCH v9 0/7] Expanded statistics reporting Remy Horton
2017-01-18 15:05                 ` [dpdk-dev] [PATCH v9 1/7] lib: add information metrics library Remy Horton
2017-01-30 15:50                   ` Thomas Monjalon
2017-01-30 21:44                     ` Remy Horton
2017-01-31 13:13                     ` Mcnamara, John
2017-01-31 13:28                       ` Bruce Richardson
2017-02-02 17:22                         ` Thomas Monjalon
2017-01-18 15:05                 ` [dpdk-dev] [PATCH v9 2/7] app/proc_info: add metrics displaying Remy Horton
2017-01-18 15:05                 ` [dpdk-dev] [PATCH v9 3/7] lib: add bitrate statistics library Remy Horton
2017-01-18 15:05                 ` [dpdk-dev] [PATCH v9 4/7] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-01-18 15:05                 ` [dpdk-dev] [PATCH v9 5/7] mbuf: add a timestamp to the mbuf for latencystats Remy Horton
2017-01-18 15:05                 ` [dpdk-dev] [PATCH v9 6/7] lib: added new library for latency stats Remy Horton
2017-01-18 15:05                 ` Remy Horton [this message]
2017-02-03 10:33                 ` [dpdk-dev] [PATCH v10 0/7] Expanded statistics reporting Remy Horton
2017-02-03 10:33                   ` [dpdk-dev] [PATCH v10 1/7] lib: add information metrics library Remy Horton
2017-02-03 10:33                   ` [dpdk-dev] [PATCH v10 2/7] app/proc_info: add metrics displaying Remy Horton
2017-02-03 10:33                   ` [dpdk-dev] [PATCH v10 3/7] lib: add bitrate statistics library Remy Horton
2017-02-03 10:33                   ` [dpdk-dev] [PATCH v10 4/7] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-02-03 10:33                   ` [dpdk-dev] [PATCH v10 5/7] mbuf: add a timestamp to the mbuf for latencystats Remy Horton
2017-02-03 10:33                   ` [dpdk-dev] [PATCH v10 6/7] lib: added new library for latency stats Remy Horton
2017-02-03 10:33                   ` [dpdk-dev] [PATCH v10 7/7] app/test-pmd: add latency statistics calculation Remy Horton
2017-02-16 10:53                   ` [dpdk-dev] [PATCH v10 0/7] Expanded statistics reporting Thomas Monjalon
2017-02-23  7:09                     ` Remy Horton
2017-02-23  8:45                       ` Thomas Monjalon
2017-03-09 16:25                   ` [dpdk-dev] [PATCH v11 " Remy Horton
2017-03-09 16:25                     ` [dpdk-dev] [PATCH v11 1/7] lib: add information metrics library Remy Horton
2017-03-09 16:25                     ` [dpdk-dev] [PATCH v11 2/7] app/proc_info: add metrics displaying Remy Horton
2017-03-09 16:25                     ` [dpdk-dev] [PATCH v11 3/7] lib: add bitrate statistics library Remy Horton
2017-03-09 16:25                     ` [dpdk-dev] [PATCH v11 4/7] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-03-09 16:25                     ` [dpdk-dev] [PATCH v11 5/7] mbuf: add a timestamp to the mbuf for latencystats Remy Horton
2017-03-09 19:02                       ` Stephen Hemminger
2017-03-10  9:48                         ` Van Haaren, Harry
2017-03-09 16:25                     ` [dpdk-dev] [PATCH v11 6/7] lib: added new library for latency stats Remy Horton
2017-03-09 16:25                     ` [dpdk-dev] [PATCH v11 7/7] app/test-pmd: add latency statistics calculation Remy Horton

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=1484751943-22877-8-git-send-email-remy.horton@intel.com \
    --to=remy.horton@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=reshma.pattan@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).