On 11/12/2023 1:07 AM, Steven Rostedt wrote:
On Sat, 11 Nov 2023 11:25:22 +0530 Krishna chaitanya chundru <[email protected]> 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
Sure steve I will change as suggested in my next patch. - Krishna Chaitanya.
+#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,

