lkml.org 
[lkml]   [2009]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjecttracing/events: Add tasklet tracepoints

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 */

\
 
 \ /
  Last update: 2009-05-26 06:41    [W:0.073 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site