Re: [PATCH 2/2] tracing: Add sample code for custom trace events

From: Steven Rostedt
Date: Wed Mar 02 2022 - 22:26:16 EST


On Thu, 3 Mar 2022 10:40:06 +0900
Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:

> > +static struct trace_event_call sched_switch_call = {
> > + .class = &sched_switch_class,
> > + .event = {
> > + .funcs = &sched_switch_funcs,
> > + },
> > + .print_fmt = SCHED_PRINT_FMT,
> > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
> > + .module = THIS_MODULE,
> > +#else
> > + .mod = THIS_MODULE,
> > +#endif
>
> I think this example code doesn't need to care about older kernels.

Oops, I thought I got rid of all the mod versions :-p I had this
working on a 5.4 kernel that we were going use, and there was a bunch
more of these in my original code. I'll nuke this on v2.

>
> Others looks good to me.
>
> Reviewed-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
>
> Hopefully, it is more helpful if there are more comments for other developers. :-)
> (and usage comments too)

Actually, I was thinking of coming up with a bunch of helper
functions/macros to make this less complex. But yeah, it needs a bunch
of comments before it can be accepted.

Thanks a lot for the review!

-- Steve