summaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_sched_switch.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-05-12 21:20:51 +0200
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 21:04:06 +0200
commit57422797dc009fc83766bcf230d29dbe6e08e21e (patch)
tree9ba5768539c08d99679f72a9709f5e345fd359c9 /kernel/trace/trace_sched_switch.c
parente309b41dd65aa953f86765eeeecc941d8e1e8b8f (diff)
downloadop-kernel-dev-57422797dc009fc83766bcf230d29dbe6e08e21e.zip
op-kernel-dev-57422797dc009fc83766bcf230d29dbe6e08e21e.tar.gz
ftrace: add wakeup events to sched tracer
Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/trace/trace_sched_switch.c')
-rw-r--r--kernel/trace/trace_sched_switch.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index b738eac..8b1cf1a 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -41,6 +41,29 @@ ctx_switch_func(struct task_struct *prev, struct task_struct *next)
local_irq_restore(flags);
}
+static void wakeup_func(struct task_struct *wakee, struct task_struct *curr)
+{
+ struct trace_array *tr = ctx_trace;
+ struct trace_array_cpu *data;
+ unsigned long flags;
+ long disabled;
+ int cpu;
+
+ if (!tracer_enabled)
+ return;
+
+ local_irq_save(flags);
+ cpu = raw_smp_processor_id();
+ data = tr->data[cpu];
+ disabled = atomic_inc_return(&data->disabled);
+
+ if (likely(disabled == 1))
+ tracing_sched_wakeup_trace(tr, data, wakee, curr, flags);
+
+ atomic_dec(&data->disabled);
+ local_irq_restore(flags);
+}
+
void ftrace_ctx_switch(struct task_struct *prev, struct task_struct *next)
{
tracing_record_cmdline(prev);
@@ -57,6 +80,19 @@ void ftrace_ctx_switch(struct task_struct *prev, struct task_struct *next)
wakeup_sched_switch(prev, next);
}
+void
+ftrace_wake_up_task(struct task_struct *wakee, struct task_struct *curr)
+{
+ tracing_record_cmdline(curr);
+
+ wakeup_func(wakee, curr);
+
+ /*
+ * Chain to the wakeup tracer (this is a NOP if disabled):
+ */
+ wakeup_sched_wakeup(wakee, curr);
+}
+
static void sched_switch_reset(struct trace_array *tr)
{
int cpu;
OpenPOWER on IntegriCloud