[v5] app/testpmd: add trace dump command

Message ID 20230627130910.9516-1-viacheslavo@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v5] app/testpmd: add trace dump command |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Slava Ovsiienko June 27, 2023, 1:09 p.m. UTC
  The "dump_trace" CLI command is added to trigger
saving the trace dumps to the trace directory.

The tracing data are saved according to the EAL configuration
(explicit --trace-dir EAL command line parameter alters
the target folder to save). The result dump folder gets the name
like rte-YYYY-MM-DD-xx-HH-MM-SS format.

This command is useful to get the trace date without exiting
testpmd application and to get the multiple dumps to observe
the situation in dynamics.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

--

v1: https://inbox.dpdk.org/dev/20230609152847.32496-2-viacheslavo@nvidia.com
v2: https://inbox.dpdk.org/dev/20230613165845.19109-2-viacheslavo@nvidia.com
    - changed to save_trace command
    - Windows compilation check added

v3: https://inbox.dpdk.org/dev/20230626110734.14126-1-viacheslavo@nvidia.com
    - reverted to "dump_trace" command

v4: http://patches.dpdk.org/project/dpdk/patch/20230626115749.8961-1-viacheslavo@nvidia.com/
    - added missed header file include
    - missed #ifdef added for Windows compilation (no trace support
      for Windows)

v5: - dump_trace command documented
    - dump commands order neating
    - checkpatch issue (white space) fixed
---
 app/test-pmd/cmdline.c                      | 8 ++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++++++
 2 files changed, 15 insertions(+)
  

Comments

Ferruh Yigit June 27, 2023, 3:18 p.m. UTC | #1
On 6/27/2023 2:09 PM, Viacheslav Ovsiienko wrote:
> The "dump_trace" CLI command is added to trigger
> saving the trace dumps to the trace directory.
> 
> The tracing data are saved according to the EAL configuration
> (explicit --trace-dir EAL command line parameter alters
> the target folder to save). The result dump folder gets the name
> like rte-YYYY-MM-DD-xx-HH-MM-SS format.
> 
> This command is useful to get the trace date without exiting
> testpmd application and to get the multiple dumps to observe
> the situation in dynamics.
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 

Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>


Help message for dump_trace command are still missing, but all can be
added with a single commit, so OK to continue with this.

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5da38b0bb4..18e6e19497 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -39,6 +39,7 @@ 
 #include <rte_gro.h>
 #endif
 #include <rte_mbuf_dyn.h>
+#include <rte_trace.h>
 
 #include <cmdline_rdline.h>
 #include <cmdline_parse.h>
@@ -8369,6 +8370,10 @@  static void cmd_dump_parsed(void *parsed_result,
 		rte_devargs_dump(stdout);
 	else if (!strcmp(res->dump, "dump_lcores"))
 		rte_lcore_dump(stdout);
+#ifndef RTE_EXEC_ENV_WINDOWS
+	else if (!strcmp(res->dump, "dump_trace"))
+		rte_trace_save();
+#endif
 	else if (!strcmp(res->dump, "dump_log_types"))
 		rte_log_dump(stdout);
 }
@@ -8383,6 +8388,9 @@  static cmdline_parse_token_string_t cmd_dump_dump =
 		"dump_mempool#"
 		"dump_devargs#"
 		"dump_lcores#"
+#ifndef RTE_EXEC_ENV_WINDOWS
+		"dump_trace#"
+#endif
 		"dump_log_types");
 
 static cmdline_parse_inst_t cmd_dump = {
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index b755c38c98..8660883ae3 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -598,6 +598,13 @@  Dumps the logical cores list::
 
    testpmd> dump_lcores
 
+dump trace
+~~~~~~~~~~
+
+Dumps the tracing data to the folder according to the current EAL settings::
+
+   testpmd> dump_trace
+
 dump log types
 ~~~~~~~~~~~~~~