From: Steven Rostedt <rostedt@goodmis.org>
To: Krishna chaitanya chundru <quic_krichai@quicinc.com>
Cc: Manivannan Sadhasivam <mani@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
<linux-kernel@vger.kernel.org>, <mhi@lists.linux.dev>,
<linux-arm-msm@vger.kernel.org>,
<linux-trace-kernel@vger.kernel.org>, <quic_vbadigan@quicinc.com>,
<quic_ramkri@quicinc.com>, <quic_nitegupt@quicinc.com>,
<quic_skananth@quicinc.com>, <quic_parass@quicinc.com>
Subject: Re: [PATCH v4] bus: mhi: host: Add tracing support
Date: Sat, 11 Nov 2023 14:37:10 -0500 [thread overview]
Message-ID: <20231111143710.3474e05a@rorschach.local.home> (raw)
In-Reply-To: <20231111-ftrace_support-v4-1-c83602399461@quicinc.com>
On Sat, 11 Nov 2023 11:25:22 +0530
Krishna chaitanya chundru <quic_krichai@quicinc.com> wrote:
> diff --git a/drivers/bus/mhi/host/trace.h b/drivers/bus/mhi/host/trace.h
> new file mode 100644
> index 000000000000..0e99318f5d08
> --- /dev/null
> +++ b/drivers/bus/mhi/host/trace.h
> +
> +TRACE_EVENT(mhi_update_channel_state_start,
> +
> + TP_PROTO(const char *name, int ch_num, int state),
> +
> + TP_ARGS(name, ch_num, state),
> +
> + TP_STRUCT__entry(
> + __string(name, name)
> + __field(int, ch_num)
> + __field(int, state)
> + ),
> +
> + TP_fast_assign(
> + __assign_str(name, name);
> + __entry->ch_num = ch_num;
> + __entry->state = state;
> + ),
> +
> + TP_printk("%s: ch%d: Updating state to: %s\n",
> + __get_str(name), __entry->ch_num,
> + TO_CH_STATE_TYPE_STR(__entry->state))
> +);
> +
> +TRACE_EVENT(mhi_update_channel_state_end,
> +
> + TP_PROTO(const char *name, int ch_num, int state),
> +
> + TP_ARGS(name, ch_num, state),
> +
> + TP_STRUCT__entry(
> + __string(name, name)
> + __field(int, ch_num)
> + __field(int, state)
> + ),
> +
> + TP_fast_assign(
> + __assign_str(name, name);
> + __entry->ch_num = ch_num;
> + __entry->state = state;
> + ),
> +
> + TP_printk("%s: ch%d: Updated state to: %s\n",
> + __get_str(name), __entry->ch_num,
> + TO_CH_STATE_TYPE_STR(__entry->state))
> +);
> +
The above three events have the same format. You can save kilobytes of
memory by converting them into a DECLARE_EVENT_CLASS() and use
DEFINE_EVENT() for each event.
A TRACE_EVENT() macro is really just a wrapper around
DECLARE_EVENT_CLASS() and DEFINE_EVENT(). The DECLARE_EVENT_CLASS()
does the bulk of the work and adds the most memory footprint. By
breaking it apart for several events, it does save memory.
Whenever you can use a single DECLARE_EVENT_CLASS() for multiple
events, I strongly suggest doing so.
Thanks,
-- Steve
> +#endif
> +#undef TRACE_INCLUDE_PATH
> +#define TRACE_INCLUDE_PATH .
> +#undef TRACE_INCLUDE_FILE
> +#define TRACE_INCLUDE_FILE trace
> +
> +#include <trace/define_trace.h>
>
> ---
> base-commit: 3006adf3be79cde4d14b1800b963b82b6e5572e0
> change-id: 20231005-ftrace_support-6869d4156139
>
> Best regards,
next prev parent reply other threads:[~2023-11-11 19:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-11 5:55 [PATCH v4] bus: mhi: host: Add tracing support Krishna chaitanya chundru
2023-11-11 7:52 ` kernel test robot
2023-11-11 13:19 ` kernel test robot
2023-11-11 18:18 ` kernel test robot
2023-11-11 19:37 ` Steven Rostedt [this message]
2023-11-14 4:35 ` Krishna Chaitanya Chundru
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=20231111143710.3474e05a@rorschach.local.home \
--to=rostedt@goodmis.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mani@kernel.org \
--cc=mhi@lists.linux.dev \
--cc=mhiramat@kernel.org \
--cc=quic_krichai@quicinc.com \
--cc=quic_nitegupt@quicinc.com \
--cc=quic_parass@quicinc.com \
--cc=quic_ramkri@quicinc.com \
--cc=quic_skananth@quicinc.com \
--cc=quic_vbadigan@quicinc.com \
/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