From: Frederic Weisbecker <fweisbec@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH] workqueue: Add a trace event for works enqueuing
Date: Thu, 30 Sep 2010 17:39:00 +0200 [thread overview]
Message-ID: <1285861140-5948-1-git-send-regression-fweisbec@gmail.com> (raw)
Tracing worklet queuing provides useful informations to understand
their lifecycles. Combined with timers trace events, we can also
extend the informations about this lifecycle from delayed queueing.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
include/trace/events/workqueue.h | 32 ++++++++++++++++++++++++++++++++
kernel/workqueue.c | 2 ++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index 49682d7..4c2ec52 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h
@@ -7,6 +7,38 @@
#include <linux/tracepoint.h>
#include <linux/workqueue.h>
+
+/**
+ * workqueue_queue_work - called when a work gets queued
+ * @work: pointer to struct work_struct
+ * @wq: workqueue structure
+ *
+ * Allows to track workqueue execution. This event occurs when
+ * a work is queued immediately or once a delayed work is actually
+ * queued on a workqueue (ie: once the delay has been reached).
+ */
+TRACE_EVENT(workqueue_queue_work,
+
+ TP_PROTO(struct work_struct *work, struct workqueue_struct *wq),
+
+ TP_ARGS(work, wq),
+
+ TP_STRUCT__entry(
+ __field( void *, work )
+ __field( void *, function)
+ __field( void *, workqueue)
+ ),
+
+ TP_fast_assign(
+ __entry->work = work;
+ __entry->function = work->func;
+ __entry->workqueue = wq;
+ ),
+
+ TP_printk("work struct=%p function=%pf workqueue=%p",
+ __entry->work, __entry->function, __entry->workqueue)
+);
+
/**
* workqueue_execute_start - called immediately before the workqueue callback
* @work: pointer to struct work_struct
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index f77afd9..5ed9f89 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -959,6 +959,8 @@ static void __queue_work(unsigned int cpu, struct workqueue_struct *wq,
if (WARN_ON_ONCE(wq->flags & WQ_DYING))
return;
+ trace_workqueue_queue_work(work, wq);
+
/* determine gcwq to use */
if (!(wq->flags & WQ_UNBOUND)) {
struct global_cwq *last_gcwq;
--
1.6.2.3
next reply other threads:[~2010-09-30 15:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-30 15:39 Frederic Weisbecker [this message]
2010-10-04 14:46 ` Tejun Heo
2010-10-04 15:54 ` Frederic Weisbecker
2010-10-05 8:59 ` [PATCH wq#for-next 1/2] workqueue: prepare for more tracepoints Tejun Heo
2010-10-05 8:59 ` [PATCH wq#for-next 2/2] workqueue: add queue_work and activate_work trace points Tejun Heo
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=1285861140-5948-1-git-send-regression-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
/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
Powered by JetHome