diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-05-12 15:20:51 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-23 15:04:06 -0400 |
commit | 57422797dc009fc83766bcf230d29dbe6e08e21e (patch) | |
tree | 9ba5768539c08d99679f72a9709f5e345fd359c9 /kernel/trace/trace_sched_switch.c | |
parent | e309b41dd65aa953f86765eeeecc941d8e1e8b8f (diff) |
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.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index b738eaca1db..8b1cf1a3aee 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) | |||
41 | local_irq_restore(flags); | 41 | local_irq_restore(flags); |
42 | } | 42 | } |
43 | 43 | ||
44 | static void wakeup_func(struct task_struct *wakee, struct task_struct *curr) | ||
45 | { | ||
46 | struct trace_array *tr = ctx_trace; | ||
47 | struct trace_array_cpu *data; | ||
48 | unsigned long flags; | ||
49 | long disabled; | ||
50 | int cpu; | ||
51 | |||
52 | if (!tracer_enabled) | ||
53 | return; | ||
54 | |||
55 | local_irq_save(flags); | ||
56 | cpu = raw_smp_processor_id(); | ||
57 | data = tr->data[cpu]; | ||
58 | disabled = atomic_inc_return(&data->disabled); | ||
59 | |||
60 | if (likely(disabled == 1)) | ||
61 | tracing_sched_wakeup_trace(tr, data, wakee, curr, flags); | ||
62 | |||
63 | atomic_dec(&data->disabled); | ||
64 | local_irq_restore(flags); | ||
65 | } | ||
66 | |||
44 | void ftrace_ctx_switch(struct task_struct *prev, struct task_struct *next) | 67 | void ftrace_ctx_switch(struct task_struct *prev, struct task_struct *next) |
45 | { | 68 | { |
46 | tracing_record_cmdline(prev); | 69 | tracing_record_cmdline(prev); |
@@ -57,6 +80,19 @@ void ftrace_ctx_switch(struct task_struct *prev, struct task_struct *next) | |||
57 | wakeup_sched_switch(prev, next); | 80 | wakeup_sched_switch(prev, next); |
58 | } | 81 | } |
59 | 82 | ||
83 | void | ||
84 | ftrace_wake_up_task(struct task_struct *wakee, struct task_struct *curr) | ||
85 | { | ||
86 | tracing_record_cmdline(curr); | ||
87 | |||
88 | wakeup_func(wakee, curr); | ||
89 | |||
90 | /* | ||
91 | * Chain to the wakeup tracer (this is a NOP if disabled): | ||
92 | */ | ||
93 | wakeup_sched_wakeup(wakee, curr); | ||
94 | } | ||
95 | |||
60 | static void sched_switch_reset(struct trace_array *tr) | 96 | static void sched_switch_reset(struct trace_array *tr) |
61 | { | 97 | { |
62 | int cpu; | 98 | int cpu; |