public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] workqueue: Add a trace event for works enqueuing
@ 2010-09-30 15:39 Frederic Weisbecker
  2010-10-04 14:46 ` Tejun Heo
  0 siblings, 1 reply; 5+ messages in thread
From: Frederic Weisbecker @ 2010-09-30 15:39 UTC (permalink / raw)
  To: Tejun Heo; +Cc: LKML, Frederic Weisbecker, Steven Rostedt, Ingo Molnar

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-05  8:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30 15:39 [PATCH] workqueue: Add a trace event for works enqueuing Frederic Weisbecker
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox