[dpdk-dev] [PATCH v2 1/3] app/testpmd: add profiling flags set command
Viacheslav Ovsiienko
viacheslavo at mellanox.com
Thu Mar 19 14:50:49 CET 2020
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 at 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
More information about the dev
mailing list