[v4] app/testpmd: add trace dump command

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

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Slava Ovsiienko June 26, 2023, 11:57 a.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: - added missed header file include
    - missed #ifdef added for Windows compilation (no trace support
      for Windows)
---
 app/test-pmd/cmdline.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Ferruh Yigit June 27, 2023, 11:34 a.m. UTC | #1
On 6/26/2023 12:57 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>

> --
> 
> 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: - added missed header file include
>     - missed #ifdef added for Windows compilation (no trace support
>       for Windows)
> ---
>  app/test-pmd/cmdline.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

Can you please update 'doc/guides/testpmd_app_ug/testpmd_funcs.rst' for
new command?

It looks like dump_* commands missed in the help output,
'cmd_help_long_parsed()', can you please append this new one end of
"display" section, we can complete the missing ones later?

<...>

> @@ -8371,10 +8372,17 @@ static void cmd_dump_parsed(void *parsed_result,
>  		rte_lcore_dump(stdout);
>  	else if (!strcmp(res->dump, "dump_log_types"))
>  		rte_log_dump(stdout);
> +#ifndef RTE_EXEC_ENV_WINDOWS
> +	else if (!strcmp(res->dump, "dump_trace"))
> +		rte_trace_save();
> +#endif		
>  }
>  
>  static cmdline_parse_token_string_t cmd_dump_dump =
>  	TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump,
> +#ifndef RTE_EXEC_ENV_WINDOWS
> +		"dump_trace#"
> +#endif
>

Why not add "dump_trace#" as last item, to keep same order with
'cmd_dump_parsed()'?
  
Slava Ovsiienko June 27, 2023, 11:39 a.m. UTC | #2
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Tuesday, June 27, 2023 2:35 PM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; dev@dpdk.org
> Cc: jerinj@marvell.com
> Subject: Re: [PATCH v4] app/testpmd: add trace dump command
> 
> On 6/26/2023 12:57 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>
> 
> > --
> >
> > v1:
> > https://inbox.dpdk.org/dev/20230609152847.32496-2-viacheslavo@nvidia.c
> > om
> > 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: - added missed header file include
> >     - missed #ifdef added for Windows compilation (no trace support
> >       for Windows)
> > ---
> >  app/test-pmd/cmdline.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> 
> Can you please update 'doc/guides/testpmd_app_ug/testpmd_funcs.rst' for
> new command?
Sure.

> 
> It looks like dump_* commands missed in the help output,
> 'cmd_help_long_parsed()', can you please append this new one end of
> "display" section, we can complete the missing ones later?
> 
> <...>
> 
> > @@ -8371,10 +8372,17 @@ static void cmd_dump_parsed(void
> *parsed_result,
> >  		rte_lcore_dump(stdout);
> >  	else if (!strcmp(res->dump, "dump_log_types"))
> >  		rte_log_dump(stdout);
> > +#ifndef RTE_EXEC_ENV_WINDOWS
> > +	else if (!strcmp(res->dump, "dump_trace"))
> > +		rte_trace_save();
> > +#endif
> >  }
> >
> >  static cmdline_parse_token_string_t cmd_dump_dump =
> >  	TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump,
> > +#ifndef RTE_EXEC_ENV_WINDOWS
> > +		"dump_trace#"
> > +#endif
> >
> 
> Why not add "dump_trace#" as last item, to keep same order with
> 'cmd_dump_parsed()'?

This would require modify the preceding command undef #ifndef and #else:
#ifndef RTE_EXEC_ENV_WINDOWS
"dump_log_types#
"dump_trace");
#else
"dump_log_types");
#endif

If you think order is more important - please,  let me know, I'll update

With best regards,
Slava
  
Ferruh Yigit June 27, 2023, 11:58 a.m. UTC | #3
On 6/27/2023 12:39 PM, Slava Ovsiienko wrote:
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@amd.com>
>> Sent: Tuesday, June 27, 2023 2:35 PM
>> To: Slava Ovsiienko <viacheslavo@nvidia.com>; dev@dpdk.org
>> Cc: jerinj@marvell.com
>> Subject: Re: [PATCH v4] app/testpmd: add trace dump command
>>
>> On 6/26/2023 12:57 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>
>>
>>> --
>>>
>>> v1:
>>> https://inbox.dpdk.org/dev/20230609152847.32496-2-viacheslavo@nvidia.c
>>> om
>>> 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: - added missed header file include
>>>     - missed #ifdef added for Windows compilation (no trace support
>>>       for Windows)
>>> ---
>>>  app/test-pmd/cmdline.c | 8 ++++++++
>>>  1 file changed, 8 insertions(+)
>>>
>>
>> Can you please update 'doc/guides/testpmd_app_ug/testpmd_funcs.rst' for
>> new command?
> Sure.
> 
>>
>> It looks like dump_* commands missed in the help output,
>> 'cmd_help_long_parsed()', can you please append this new one end of
>> "display" section, we can complete the missing ones later?
>>
>> <...>
>>
>>> @@ -8371,10 +8372,17 @@ static void cmd_dump_parsed(void
>> *parsed_result,
>>>  		rte_lcore_dump(stdout);
>>>  	else if (!strcmp(res->dump, "dump_log_types"))
>>>  		rte_log_dump(stdout);
>>> +#ifndef RTE_EXEC_ENV_WINDOWS
>>> +	else if (!strcmp(res->dump, "dump_trace"))
>>> +		rte_trace_save();
>>> +#endif
>>>  }
>>>
>>>  static cmdline_parse_token_string_t cmd_dump_dump =
>>>  	TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump,
>>> +#ifndef RTE_EXEC_ENV_WINDOWS
>>> +		"dump_trace#"
>>> +#endif
>>>
>>
>> Why not add "dump_trace#" as last item, to keep same order with
>> 'cmd_dump_parsed()'?
> 
> This would require modify the preceding command undef #ifndef and #else:
> #ifndef RTE_EXEC_ENV_WINDOWS
> "dump_log_types#
> "dump_trace");
> #else
> "dump_log_types");
> #endif
> 
> If you think order is more important - please,  let me know, I'll update
> 

Lets move it just before 'dump_log_types', in both instance :)
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5da38b0bb4..b82763c65d 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>
@@ -8371,10 +8372,17 @@  static void cmd_dump_parsed(void *parsed_result,
 		rte_lcore_dump(stdout);
 	else if (!strcmp(res->dump, "dump_log_types"))
 		rte_log_dump(stdout);
+#ifndef RTE_EXEC_ENV_WINDOWS
+	else if (!strcmp(res->dump, "dump_trace"))
+		rte_trace_save();
+#endif		
 }
 
 static cmdline_parse_token_string_t cmd_dump_dump =
 	TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump,
+#ifndef RTE_EXEC_ENV_WINDOWS
+		"dump_trace#"
+#endif
 		"dump_physmem#"
 		"dump_memzone#"
 		"dump_socket_mem#"