DPDK patches and discussions
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, thomas@monjalon.net, bernard.iremonger@intel.com
Subject: [dpdk-dev] [PATCH v2 1/3] app/testpmd: add profiling flags set command
Date: Thu, 19 Mar 2020 13:50:49 +0000	[thread overview]
Message-ID: <1584625851-10291-2-git-send-email-viacheslavo@mellanox.com> (raw)
In-Reply-To: <1584625851-10291-1-git-send-email-viacheslavo@mellanox.com>

This commit is preparation step before adding the separated profiling
of Rx and Tx burst routines. The new testpmd command is introduced:

  set fwdprof (flags)

This command controls which profiling statistics is being gathered
in runtime:

- bit 0 - enables profiling the entire forward routine, counts the ticks
          spent in the forwarding routine, is set by default. Provides the
	  same data as previous implementation.

- bit 1 - enables gathering the profiling data for the transmit datapath,
          counts the ticks spent within rte_eth_tx_burst() routine,
          is cleared by default, extends the existing statistics.

- bit 2 - enables gathering the profiling data for the receive datapath,
          counts the ticks spent within rte_eth_rx_burst() routine,
          is cleared by default, extends the existing statistics.

The new counters for the cycles spent into rx/tx burst
routines are introduced. The feature is engaged only if
CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES configured to 'Y'.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 app/test-pmd/cmdline.c                      | 15 +++++++++++++++
 app/test-pmd/config.c                       | 10 ++++++++++
 app/test-pmd/testpmd.c                      |  3 +++
 app/test-pmd/testpmd.h                      |  8 ++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 22 ++++++++++++++++++++++
 5 files changed, 58 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a037a55..74dbb29 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -263,6 +263,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set verbose (level)\n"
 			"    Set the debug verbosity level X.\n\n"
 
+			"set fwdprof (flags)\n"
+			"    Set the flags to profile the forwarding.\n\n"
+
 			"set log global|(type) (level)\n"
 			"    Set the log level.\n\n"
 
@@ -3743,20 +3746,32 @@ static void cmd_set_parsed(void *parsed_result,
 		set_nb_pkt_per_burst(res->value);
 	else if (!strcmp(res->what, "verbose"))
 		set_verbose_level(res->value);
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+	else if (!strcmp(res->what, "fwdprof"))
+		set_fwdprof_flags(res->value);
+#endif
 }
 
 cmdline_parse_token_string_t cmd_set_set =
 	TOKEN_STRING_INITIALIZER(struct cmd_set_result, set, "set");
 cmdline_parse_token_string_t cmd_set_what =
 	TOKEN_STRING_INITIALIZER(struct cmd_set_result, what,
+#ifndef RTE_TEST_PMD_RECORD_CORE_CYCLES
 				 "nbport#nbcore#burst#verbose");
+#else
+				 "nbport#nbcore#burst#verbose#fwdprof");
+#endif
 cmdline_parse_token_num_t cmd_set_value =
 	TOKEN_NUM_INITIALIZER(struct cmd_set_result, value, UINT16);
 
 cmdline_parse_inst_t cmd_set_numbers = {
 	.f = cmd_set_parsed,
 	.data = NULL,
+#ifndef RTE_TEST_PMD_RECORD_CORE_CYCLES
 	.help_str = "set nbport|nbcore|burst|verbose <value>",
+#else
+	.help_str = "set nbport|nbcore|burst|verbose|fwdprof <value>",
+#endif
 	.tokens = {
 		(void *)&cmd_set_set,
 		(void *)&cmd_set_what,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 8cf84cc..1d86250 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3151,6 +3151,16 @@ struct igb_ring_desc_16_bytes {
 	configure_rxtx_dump_callbacks(verbose_level);
 }
 
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+void
+set_fwdprof_flags(uint16_t pf_flags)
+{
+	printf("Change forward profiling flags from %u to %u\n",
+	       (unsigned int) fwdprof_flags, (unsigned int) pf_flags);
+	fwdprof_flags = pf_flags;
+}
+#endif
+
 void
 vlan_extend_set(portid_t port_id, int on)
 {
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 035836a..c93fa35 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -81,6 +81,9 @@
 #define EXTBUF_ZONE_SIZE RTE_PGSIZE_2M
 
 uint16_t verbose_level = 0; /**< Silent by default. */
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+uint16_t fwdprof_flags = RECORD_CORE_CYCLES_FWD; /**< Fwd only by default. */
+#endif
 int testpmd_logtype; /**< Log type for testpmd logs */
 
 /* use master core for command line ? */
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 7a7c73f..466e611 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -321,8 +321,15 @@ struct queue_stats_mappings {
 
 extern uint8_t xstats_hide_zero; /**< Hide zero values for xstats display */
 
+#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
+#define RECORD_CORE_CYCLES_FWD (1<<0)
+#define RECORD_CORE_CYCLES_RX (1<<1)
+#define RECORD_CORE_CYCLES_TX (1<<2)
+#endif
+
 /* globals used for configuration */
 extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
+extern uint16_t fwdprof_flags; /**< Controls the profiling statistics. */
 extern int testpmd_logtype; /**< Log type for testpmd logs */
 extern uint8_t  interactive;
 extern uint8_t  auto_start;
@@ -787,6 +794,7 @@ void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,
 void set_xstats_hide_zero(uint8_t on_off);
 
 void set_verbose_level(uint16_t vb_level);
+void set_fwdprof_flags(uint16_t pf_flags);
 void set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs);
 void show_tx_pkt_segments(void);
 void set_tx_pkt_split(const char *name);
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 5bb12a5..b6ec783 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -647,6 +647,28 @@ Regexes can also be used for type. To change log level of user1, user2 and user3
 
 	testpmd> set log user[1-3] (level)
 
+set fwdprof
+~~~~~~~~~~~
+
+Set the flags controlling the datapath profiling statistics::
+
+   testpmd> set fwdprof (flags)
+
+This command is available only if ``CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES`` is
+configured to Y, enabling the profiling code generation.
+
+The bitmask flag controls the gathering profiling statistics for datapath:
+
+* ``bit 0`` enables gathering the profiling data for the entire
+  forwarding routine, counts the ticks spent in the forwarding routine,
+  is set by default.
+* ``bit 1`` enables gathering the profiling data for the transmit datapath,
+  counts the ticks spent within rte_eth_tx_burst() routine, is cleared by
+  default.
+* ``bit 2`` enables gathering the profiling data for the receive datapath,
+  counts the ticks spent within rte_eth_rx_burst() routine, is cleared by
+  default.
+
 set nbport
 ~~~~~~~~~~
 
-- 
1.8.3.1


  reply	other threads:[~2020-03-19 13:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26 12:48 [dpdk-dev] [PATCH] app/testpmd: add profiling for Rx/Tx burst routines Viacheslav Ovsiienko
2019-06-26 12:57 ` Bruce Richardson
2019-06-26 13:19   ` Slava Ovsiienko
2019-06-26 13:21     ` Bruce Richardson
2019-06-27  4:48       ` Slava Ovsiienko
2019-06-28 13:45         ` Iremonger, Bernard
2019-06-28 14:20           ` Bruce Richardson
2019-07-01  4:57             ` Slava Ovsiienko
2019-07-01  8:15               ` Bruce Richardson
2019-09-30 12:32                 ` Yigit, Ferruh
2020-03-19 13:50 ` [dpdk-dev] [PATCH v2 0/3] app/testpmd: qualify Rx/Tx profiling data on burst size Viacheslav Ovsiienko
2020-03-19 13:50   ` Viacheslav Ovsiienko [this message]
2020-04-02 11:15     ` [dpdk-dev] [PATCH v2 1/3] app/testpmd: add profiling flags set command Thomas Monjalon
2020-04-09 11:56     ` Ferruh Yigit
2020-04-13  7:56       ` Slava Ovsiienko
2020-04-13 12:23         ` Thomas Monjalon
2020-04-14  9:07         ` Ferruh Yigit
2020-03-19 13:50   ` [dpdk-dev] [PATCH v2 2/3] app/testpmd: gather Rx and Tx routines profiling Viacheslav Ovsiienko
2020-04-02 11:20     ` Thomas Monjalon
2020-04-02 11:23       ` Slava Ovsiienko
2020-03-19 13:50   ` [dpdk-dev] [PATCH v2 3/3] app/testpmd: qualify profiling statistics on burst size Viacheslav Ovsiienko
2020-03-20  6:13     ` Jerin Jacob
2020-04-09 11:46       ` Ferruh Yigit
2020-04-09 12:49         ` Jerin Jacob
2020-03-20 16:03     ` Andrzej Ostruszka
2020-04-02 11:21     ` Thomas Monjalon
2020-04-09 12:03     ` Ferruh Yigit
2020-04-09 12:09       ` Thomas Monjalon
2020-04-02 11:13   ` [dpdk-dev] [PATCH v2 0/3] app/testpmd: qualify Rx/Tx profiling data " 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=1584625851-10291-2-git-send-email-viacheslavo@mellanox.com \
    --to=viacheslavo@mellanox.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    /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).