[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201012095955.0741313b@gandalf.local.home>
Date:   Mon, 12 Oct 2020 09:59:55 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Rob Clark <robdclark@...il.com>
Cc:     linux-kernel@...r.kernel.org, Rob Clark <robdclark@...omium.org>,
        Ingo Molnar <mingo@...hat.com>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Phil Auld <pauld@...hat.com>,
        Valentin Schneider <valentin.schneider@....com>,
        Thara Gopinath <thara.gopinath@...aro.org>,
        Randy Dunlap <rdunlap@...radead.org>,
        Vincent Donnefort <vincent.donnefort@....com>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Jens Axboe <axboe@...nel.dk>,
        Marcelo Tosatti <mtosatti@...hat.com>,
        Frederic Weisbecker <frederic@...nel.org>,
        Ilias Stamatis <stamatis.iliass@...il.com>,
        Liang Chen <cl@...k-chips.com>,
        Ben Dooks <ben.dooks@...ethink.co.uk>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        "J. Bruce Fields" <bfields@...hat.com>
Subject: Re: [PATCH] kthread: Add kthread_work tracepoints
On Sat, 10 Oct 2020 11:03:22 -0700
Rob Clark <robdclark@...il.com> 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
Powered by blists - more mailing lists
 
