public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: rostedt@goodmis.org, mingo@elte.hu, tzanussi@gmail.com,
	jbaron@redhat.com, tglx@linutronix.de, fweisbec@gmail.com,
	kosaki.motohiro@jp.fujitsu.com
Cc: linux-kernel@vger.kernel.org
Subject: tracing/events: Add tasklet tracepoints
Date: Tue, 26 May 2009 14:36:58 +1000	[thread overview]
Message-ID: <20090526043658.GE19728@kryten> (raw)
In-Reply-To: <20090526043257.GD19728@kryten>


Add tracepoints for tasklets. We add entry and exit tracepoints so we can
calculate tasklet latency.

Example ftrace output:

<idle>-0     [000]   327.349213: tasklet_entry: func=.rpavscsi_task
<idle>-0     [000]   327.349217: tasklet_exit: func=.rpavscsi_task

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-2.6-master/kernel/softirq.c
===================================================================
--- linux-2.6-master.orig/kernel/softirq.c	2009-05-26 13:56:58.000000000 +1000
+++ linux-2.6-master/kernel/softirq.c	2009-05-26 13:57:46.000000000 +1000
@@ -412,7 +412,9 @@
 			if (!atomic_read(&t->count)) {
 				if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
 					BUG();
+				trace_tasklet_entry(t);
 				t->func(t->data);
+				trace_tasklet_exit(t);
 				tasklet_unlock(t);
 				continue;
 			}
@@ -447,7 +449,9 @@
 			if (!atomic_read(&t->count)) {
 				if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
 					BUG();
+				trace_tasklet_entry(t);
 				t->func(t->data);
+				trace_tasklet_exit(t);
 				tasklet_unlock(t);
 				continue;
 			}
Index: linux-2.6-master/include/trace/events/irq.h
===================================================================
--- linux-2.6-master.orig/include/trace/events/irq.h	2009-05-26 13:56:58.000000000 +1000
+++ linux-2.6-master/include/trace/events/irq.h	2009-05-26 14:35:09.000000000 +1000
@@ -128,6 +128,54 @@
 	TP_printk("softirq=%d action=%s", __entry->vec, __get_str(name))
 );
 
+/**
+ * tasklet_entry - called immediately before the tasklet handler
+ * @t: pointer to struct tasklet_struct
+ *
+ * When used in combination with the tasklet_exit tracepoint we can
+ * determine the tasklet latency.
+ */
+TRACE_EVENT(tasklet_entry,
+
+	TP_PROTO(struct tasklet_struct *t),
+
+	TP_ARGS(t),
+
+	TP_STRUCT__entry(
+		__field(void *, func)
+	),
+
+	TP_fast_assign(
+		__entry->func = t->func;
+	),
+
+	TP_printk("func=%pf", __entry->func)
+);
+
+/**
+ * tasklet_exit - called immediately after the tasklet handler returns
+ * @t: pointer to struct tasklet_struct
+ *
+ * When used in combination with the tasklet_entry tracepoint we can
+ * determine the tasklet latency.
+ */
+TRACE_EVENT(tasklet_exit,
+
+	TP_PROTO(struct tasklet_struct *t),
+
+	TP_ARGS(t),
+
+	TP_STRUCT__entry(
+		__field(void *, func)
+	),
+
+	TP_fast_assign(
+		__entry->func = t->func;
+	),
+
+	TP_printk("func=%pf", __entry->func)
+);
+
 #endif /*  _TRACE_IRQ_H */
 
 /* This part must be outside protection */

  reply	other threads:[~2009-05-26  4:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-20 10:13 [PATCH] tracing/events: Add timer and high res timer tracepoints Anton Blanchard
2009-05-20 10:25 ` KOSAKI Motohiro
2009-05-20 10:31 ` Thomas Gleixner
2009-05-21  0:01 ` Frédéric Weisbecker
2009-05-21  0:13   ` Steven Rostedt
2009-05-21 12:38   ` Anton Blanchard
2009-05-25 20:00     ` Frederic Weisbecker
2009-05-26  4:26 ` Anton Blanchard
2009-05-26  4:31   ` [PATCH] tracing/events: Rename worklet_execute to worklet_entry and worklet_complete to worklet_exit Anton Blanchard
2009-05-26  4:32     ` [PATCH] tracing/events: Use %pf in workqueue trace events Anton Blanchard
2009-05-26  4:36       ` Anton Blanchard [this message]
2009-05-29 13:16     ` [PATCH] tracing/events: Rename worklet_execute to worklet_entry and worklet_complete to worklet_exit Frédéric Weisbecker
2009-05-26  4:55   ` [PATCH v3] tracing/events: Add timer and high res timer tracepoints Anton Blanchard
2009-05-26 18:06   ` [PATCH] " Frederic Weisbecker
2009-05-27  9:28     ` Xiao Guangrong
2009-05-27 14:22       ` Thomas Gleixner
2009-05-27 14:48         ` Frederic Weisbecker
2009-05-29  0:55           ` [PATCH] tracing/events: Add timer and high res timertracepoints Zhaolei
2009-05-27 13:46     ` [PATCH] tracing/events: Add timer and high res timer tracepoints Thomas Gleixner

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=20090526043658.GE19728@kryten \
    --to=anton@samba.org \
    --cc=fweisbec@gmail.com \
    --cc=jbaron@redhat.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tzanussi@gmail.com \
    /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