From: Jianfeng Wang <jianfeng.w.wang@oracle.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] trace-cmd: Add ftrace options for the fgraph retval feature
Date: Wed, 17 Jul 2024 13:44:43 -0700 [thread overview]
Message-ID: <228cdfa6-29a5-4647-aefb-7fa04c1b1a00@oracle.com> (raw)
In-Reply-To: <20240717145028.73683d09@rorschach.local.home>
On 7/17/24 11:50 AM, Steven Rostedt wrote:
> On Tue, 21 May 2024 14:37:30 -0700
> Jianfeng Wang <jianfeng.w.wang@oracle.com> wrote:
>
>> Add two internal options for fgraph: fgraph:retval-skip and
>> fgraph:retval-hex. By default, trace-cmd will print each function's
>> return value at the function_graph exit point, if the kernel supports
>> the fgraph-retval feature. If users want to skip the output of
>> functions' return values, then set fgraph:retval-skip. Alternatively,
>> users can set fgraph:retval-hex to force the return values to be
>> printed in hex format.
>>
>> Here are example commands:
>>> trace-cmd report -O fgraph:retval-skip
>>> trace-cmd report -O fgraph:retval-hex
>
> I would like to see a -O fgraph:retval-dec
>
> As by default most is shown in hex, having an option to do that would
> be great.
>
> -- Steve
>
>
Hi Steve,
Sorry, I am confused about this.
Do you suggesting adding one more option fgraph:retval-dec or
replacing fgraph:retval-hex with fgraph:retval-dec (and making the hex
format as the default)?
Currently, the patch prints return values in decimal by default
(without any input), while users can specify fgraph:retval-hex to let
numbers printed in hex.
Thanks for your comments.
Best,
-Jianfeng
>>
>> Signed-off-by: Jianfeng Wang <jianfeng.w.wang@oracle.com>
>> ---
>> lib/trace-cmd/trace-ftrace.c | 22 ++++++++++++++++++----
>> 1 file changed, 18 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/trace-cmd/trace-ftrace.c b/lib/trace-cmd/trace-ftrace.c
>> index 2b4e49a5..d2378833 100644
>> --- a/lib/trace-cmd/trace-ftrace.c
>> +++ b/lib/trace-cmd/trace-ftrace.c
>> @@ -26,6 +26,18 @@ struct tep_plugin_option trace_ftrace_options[] = {
>> .description =
>> "Show the depth of each entry",
>> },
>> + {
>> + .name = "retval-skip",
>> + .plugin_alias = "fgraph",
>> + .description =
>> + "Skip printing function retval in function graph",
>> + },
>> + {
>> + .name = "retval-hex",
>> + .plugin_alias = "fgraph",
>> + .description =
>> + "Print function retval in hex at function exit in function graph",
>> + },
>> {
>> .name = NULL,
>> }
>> @@ -33,6 +45,8 @@ struct tep_plugin_option trace_ftrace_options[] = {
>>
>> static struct tep_plugin_option *fgraph_tail = &trace_ftrace_options[0];
>> static struct tep_plugin_option *fgraph_depth = &trace_ftrace_options[1];
>> +static struct tep_plugin_option *fgraph_retval_skip = &trace_ftrace_options[2];
>> +static struct tep_plugin_option *fgraph_retval_hex = &trace_ftrace_options[3];
>>
>> static int find_ret_event(struct tracecmd_ftrace *finfo, struct tep_handle *pevent)
>> {
>> @@ -235,8 +249,8 @@ print_graph_entry_leaf(struct trace_seq *s,
>> ret = trace_seq_printf(s, " (%lld)", depth);
>>
>> /* Return Value */
>> - if (ret && fgraph_retval_supported) {
>> - if (!IS_LINUX_ERR_VALUE(retval))
>> + if (ret && fgraph_retval_supported && !fgraph_retval_skip->set) {
>> + if (fgraph_retval_hex->set || !IS_LINUX_ERR_VALUE(retval))
>> ret = trace_seq_printf(s, " (ret=0x%llx)", retval);
>> else
>> ret = trace_seq_printf(s, " (ret=%lld)", retval);
>> @@ -385,8 +399,8 @@ fgraph_ret_handler(struct trace_seq *s, struct tep_record *record,
>> trace_seq_printf(s, " (%lld)", depth);
>>
>> /* Return Value */
>> - if (fgraph_retval_supported) {
>> - if (!IS_LINUX_ERR_VALUE(retval))
>> + if (fgraph_retval_supported && !fgraph_retval_skip->set) {
>> + if (fgraph_retval_hex->set || !IS_LINUX_ERR_VALUE(retval))
>> trace_seq_printf(s, " (ret=0x%llx)", retval);
>> else
>> trace_seq_printf(s, " (ret=%lld)", retval);
>
next prev parent reply other threads:[~2024-07-17 20:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 21:37 [PATCH v2 0/2] trace-cmd ftrace: support function retval feature in function_graph Jianfeng Wang
2024-05-21 21:37 ` [PATCH v2 1/2] trace-cmd ftrace: print function retval " Jianfeng Wang
2024-07-17 18:48 ` Steven Rostedt
2024-05-21 21:37 ` [PATCH v2 2/2] trace-cmd: Add ftrace options for the fgraph retval feature Jianfeng Wang
2024-07-17 18:50 ` Steven Rostedt
2024-07-17 20:44 ` Jianfeng Wang [this message]
2024-07-17 20:58 ` Steven Rostedt
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=228cdfa6-29a5-4647-aefb-7fa04c1b1a00@oracle.com \
--to=jianfeng.w.wang@oracle.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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).