From: Keun-O Park <keun-o.park@windriver.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: kpark3469@gmail.com, linux-pm@vger.kernel.org,
len.brown@intel.com, rjw@sisk.pl
Subject: Re: [PATCH 1/4] PM / tracing: Add pm_qos_update_target/flags tracepoints
Date: Fri, 21 Jun 2013 11:16:21 +0900 [thread overview]
Message-ID: <51C3B775.1080401@windriver.com> (raw)
In-Reply-To: <1371731715.18733.85.camel@gandalf.local.home>
2013년 06월 20일 21:35, Steven Rostedt 쓴 글:
> On Thu, 2013-06-20 at 13:56 +0900, kpark3469@gmail.com wrote:
>
>> +DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
>> +
>> + TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
>> +
>> + TP_ARGS(action, prev_value, curr_value),
>> +
>> + TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
>> + (__entry->action == PM_QOS_ADD_REQ) ? "ADD_REQ" :
>> + (__entry->action == PM_QOS_UPDATE_REQ) ? "UPDATE_REQ" :
>> + (__entry->action == PM_QOS_REMOVE_REQ) ? "REMOVE_REQ" : "??",
>> + __entry->prev_value, __entry->curr_value)
>> +);
>> #endif /* _TRACE_POWER_H */
> Nice! I believe you are the first one to add a new event using a
> DEFINE_EVENT_PRINT(). And you did it properly (almost, see below) :-)
>
> The only other use of that was by Li Zefan who converted an existing
> event to DEFINE_EVENT_PRINT().
>
> There's a helper function to convert numbers into strings:
>
> TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
> __print_symbolic(__entry->action,
> { PM_QOS_ADD_REQ, "ADD_REQ" },
> { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
> { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
> __entry->prev_value, __entry->curr_value)
>
> The advantage of using __print_symbolic() is that it allows both perf
> and trace-cmd to read this event properly. Their parsers are not full C
> parsers, and when you open code the the processing, they both will fail
> to parse how to read the output, and will just default to printing the
> fields via their raw numbers.
>
> Another advantage is if the __entry->action is not one of the defined
> fields, instead of outputting "??" it will output the number in hex. Say
> if __entry->action is 0x123, the __print_symbolic will return "0x123" as
> a string and that will be shown to the user, letting you know the actual
> value of the field that was unknown.
>
> -- Steve
>
>
>
Thanks Steve. I modified codes to use __print_symbolic following your
recommendation.
-- Sahara
next prev parent reply other threads:[~2013-06-21 2:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 4:56 [PATCH 1/4] PM / tracing: Add pm_qos_update_target/flags tracepoints kpark3469
2013-06-20 4:56 ` [PATCH 2/4] PM / tracing: Add pm_qos_request tracepoints kpark3469
2013-06-20 4:56 ` [PATCH 3/4] PM / tracing: Add dev_pm_qos_request tracepoints kpark3469
2013-06-20 4:57 ` [PATCH 4/4] Documentation: Add pm_qos and dev_pm_qos to events-power.txt kpark3469
2013-06-20 12:35 ` [PATCH 1/4] PM / tracing: Add pm_qos_update_target/flags tracepoints Steven Rostedt
2013-06-21 2:16 ` Keun-O Park [this message]
2013-06-20 12:36 ` 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=51C3B775.1080401@windriver.com \
--to=keun-o.park@windriver.com \
--cc=kpark3469@gmail.com \
--cc=len.brown@intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.