On Sat, 10 Oct 2020 11:03:22 -0700
Rob Clark <[email protected]> wrote:
> /**
> + * sched_kthread_work_execute_start - called immediately before the work
> callback
> + * @work: pointer to struct kthread_work
> + *
> + * Allows to track kthread work execution.
> + */
> +TRACE_EVENT(sched_kthread_work_execute_start,
> +
> + TP_PROTO(struct kthread_work *work),
> +
> + TP_ARGS(work),
> +
> + TP_STRUCT__entry(
> + __field( void *, work )
> + __field( void *, function)
> + ),
> +
> + TP_fast_assign(
> + __entry->work = work;
> + __entry->function = work->func;
> + ),
> +
> + TP_printk("work struct %p: function %ps", __entry->work,
> __entry->function)
> +);
> +
> +/**
> + * sched_kthread_work_execute_end - called immediately after the work
> callback
> + * @work: pointer to struct work_struct
> + * @function: pointer to worker function
> + *
> + * Allows to track workqueue execution.
> + */
> +TRACE_EVENT(sched_kthread_work_execute_end,
> +
> + TP_PROTO(struct kthread_work *work, kthread_work_func_t function),
> +
> + TP_ARGS(work, function),
> +
> + TP_STRUCT__entry(
> + __field( void *, work )
> + __field( void *, function)
> + ),
> +
> + TP_fast_assign(
> + __entry->work = work;
> + __entry->function = function;
> + ),
> +
> + TP_printk("work struct %p: function %ps", __entry->work,
> __entry->function)
> +);
> +
Please combine the above into:
DECLARE_EVENT_CLASS(sched_kthread_work_execute_template,
TP_PROTO(struct kthread_work *work),
TP_ARGS(work),
TP_STRUCT__entry(
__field( void *, work )
__field( void *, function)
),
TP_fast_assign(
__entry->work = work;
__entry->function = work->func;
),
TP_printk("work struct %p: function %ps", __entry->work,
__entry->function)
);
DEFINE_EVENT(sched_kthread_work_execute_template,
sched_kthread_work_execute_start,
TP_PROTO(struct kthread_work *work),
TP_ARGS(work));
DEFINE_EVENT(sched_kthread_work_execute_template,
sched_kthread_work_execute_end,
TP_PROTO(struct kthread_work *work),
TP_ARGS(work));
As events are cheap, classes are expensive (size wise), and a TRACE_EVENT()
is really just a CLASS and EVENT for a single instance.
-- Steve