Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 1 | /* |
| 2 | * trace context switch |
| 3 | * |
| 4 | * Copyright (C) 2007 Steven Rostedt <srostedt@redhat.com> |
| 5 | * |
| 6 | */ |
| 7 | #include <linux/module.h> |
| 8 | #include <linux/fs.h> |
| 9 | #include <linux/debugfs.h> |
| 10 | #include <linux/kallsyms.h> |
| 11 | #include <linux/uaccess.h> |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 12 | #include <linux/ftrace.h> |
Steven Rostedt | ad8d75f | 2009-04-14 19:39:12 -0400 | [diff] [blame] | 13 | #include <trace/events/sched.h> |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 14 | |
| 15 | #include "trace.h" |
| 16 | |
| 17 | static struct trace_array *ctx_trace; |
| 18 | static int __read_mostly tracer_enabled; |
Frederic Weisbecker | efade6e | 2008-10-31 13:28:58 +0100 | [diff] [blame] | 19 | static int sched_ref; |
| 20 | static DEFINE_MUTEX(sched_register_mutex); |
Steven Rostedt | 5fec6dd | 2009-03-17 19:59:53 -0400 | [diff] [blame] | 21 | static int sched_stopped; |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 22 | |
Frederic Weisbecker | 82e04af | 2009-07-29 18:00:29 +0200 | [diff] [blame] | 23 | |
| 24 | void |
| 25 | tracing_sched_switch_trace(struct trace_array *tr, |
| 26 | struct task_struct *prev, |
| 27 | struct task_struct *next, |
| 28 | unsigned long flags, int pc) |
| 29 | { |
| 30 | struct ftrace_event_call *call = &event_context_switch; |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame^] | 31 | struct ring_buffer *buffer = tr->buffer; |
Frederic Weisbecker | 82e04af | 2009-07-29 18:00:29 +0200 | [diff] [blame] | 32 | struct ring_buffer_event *event; |
| 33 | struct ctx_switch_entry *entry; |
| 34 | |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame^] | 35 | event = trace_buffer_lock_reserve(buffer, TRACE_CTX, |
Frederic Weisbecker | 82e04af | 2009-07-29 18:00:29 +0200 | [diff] [blame] | 36 | sizeof(*entry), flags, pc); |
| 37 | if (!event) |
| 38 | return; |
| 39 | entry = ring_buffer_event_data(event); |
| 40 | entry->prev_pid = prev->pid; |
| 41 | entry->prev_prio = prev->prio; |
| 42 | entry->prev_state = prev->state; |
| 43 | entry->next_pid = next->pid; |
| 44 | entry->next_prio = next->prio; |
| 45 | entry->next_state = next->state; |
| 46 | entry->next_cpu = task_cpu(next); |
| 47 | |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame^] | 48 | if (!filter_check_discard(call, entry, buffer, event)) |
| 49 | trace_buffer_unlock_commit(buffer, event, flags, pc); |
Frederic Weisbecker | 82e04af | 2009-07-29 18:00:29 +0200 | [diff] [blame] | 50 | } |
| 51 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 52 | static void |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 53 | probe_sched_switch(struct rq *__rq, struct task_struct *prev, |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 54 | struct task_struct *next) |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 55 | { |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 56 | struct trace_array_cpu *data; |
| 57 | unsigned long flags; |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 58 | int cpu; |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 59 | int pc; |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 60 | |
Zhaolei | dcef788 | 2009-03-31 15:26:14 +0800 | [diff] [blame] | 61 | if (unlikely(!sched_ref)) |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 62 | return; |
| 63 | |
Steven Rostedt | 41bc814 | 2008-05-22 11:49:22 -0400 | [diff] [blame] | 64 | tracing_record_cmdline(prev); |
| 65 | tracing_record_cmdline(next); |
| 66 | |
Zhaolei | dcef788 | 2009-03-31 15:26:14 +0800 | [diff] [blame] | 67 | if (!tracer_enabled || sched_stopped) |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 68 | return; |
| 69 | |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 70 | pc = preempt_count(); |
Steven Rostedt | 18cef37 | 2008-05-12 21:20:44 +0200 | [diff] [blame] | 71 | local_irq_save(flags); |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 72 | cpu = raw_smp_processor_id(); |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 73 | data = ctx_trace->data[cpu]; |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 74 | |
Steven Rostedt | 3ea2e6d | 2008-10-04 02:01:00 -0400 | [diff] [blame] | 75 | if (likely(!atomic_read(&data->disabled))) |
Arnaldo Carvalho de Melo | 7be4215 | 2009-02-05 01:13:37 -0500 | [diff] [blame] | 76 | tracing_sched_switch_trace(ctx_trace, prev, next, flags, pc); |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 77 | |
Steven Rostedt | 18cef37 | 2008-05-12 21:20:44 +0200 | [diff] [blame] | 78 | local_irq_restore(flags); |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 79 | } |
| 80 | |
Frederic Weisbecker | 82e04af | 2009-07-29 18:00:29 +0200 | [diff] [blame] | 81 | void |
| 82 | tracing_sched_wakeup_trace(struct trace_array *tr, |
| 83 | struct task_struct *wakee, |
| 84 | struct task_struct *curr, |
| 85 | unsigned long flags, int pc) |
| 86 | { |
| 87 | struct ftrace_event_call *call = &event_wakeup; |
| 88 | struct ring_buffer_event *event; |
| 89 | struct ctx_switch_entry *entry; |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame^] | 90 | struct ring_buffer *buffer = tr->buffer; |
Frederic Weisbecker | 82e04af | 2009-07-29 18:00:29 +0200 | [diff] [blame] | 91 | |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame^] | 92 | event = trace_buffer_lock_reserve(buffer, TRACE_WAKE, |
Frederic Weisbecker | 82e04af | 2009-07-29 18:00:29 +0200 | [diff] [blame] | 93 | sizeof(*entry), flags, pc); |
| 94 | if (!event) |
| 95 | return; |
| 96 | entry = ring_buffer_event_data(event); |
| 97 | entry->prev_pid = curr->pid; |
| 98 | entry->prev_prio = curr->prio; |
| 99 | entry->prev_state = curr->state; |
| 100 | entry->next_pid = wakee->pid; |
| 101 | entry->next_prio = wakee->prio; |
| 102 | entry->next_state = wakee->state; |
| 103 | entry->next_cpu = task_cpu(wakee); |
| 104 | |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame^] | 105 | if (!filter_check_discard(call, entry, buffer, event)) |
| 106 | ring_buffer_unlock_commit(buffer, event); |
| 107 | ftrace_trace_stack(tr->buffer, flags, 6, pc); |
| 108 | ftrace_trace_userstack(tr->buffer, flags, pc); |
Frederic Weisbecker | 82e04af | 2009-07-29 18:00:29 +0200 | [diff] [blame] | 109 | } |
| 110 | |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 111 | static void |
Peter Zijlstra | 468a15b | 2008-12-16 08:07:03 +0100 | [diff] [blame] | 112 | probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success) |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 113 | { |
Ingo Molnar | 5742279 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 114 | struct trace_array_cpu *data; |
| 115 | unsigned long flags; |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 116 | int cpu, pc; |
Ingo Molnar | 5742279 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 117 | |
Zhaolei | dcef788 | 2009-03-31 15:26:14 +0800 | [diff] [blame] | 118 | if (unlikely(!sched_ref)) |
| 119 | return; |
| 120 | |
| 121 | tracing_record_cmdline(current); |
| 122 | |
| 123 | if (!tracer_enabled || sched_stopped) |
Ingo Molnar | 5742279 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 124 | return; |
| 125 | |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 126 | pc = preempt_count(); |
Ingo Molnar | 5742279 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 127 | local_irq_save(flags); |
| 128 | cpu = raw_smp_processor_id(); |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 129 | data = ctx_trace->data[cpu]; |
Ingo Molnar | 5742279 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 130 | |
Steven Rostedt | 3ea2e6d | 2008-10-04 02:01:00 -0400 | [diff] [blame] | 131 | if (likely(!atomic_read(&data->disabled))) |
Arnaldo Carvalho de Melo | 7be4215 | 2009-02-05 01:13:37 -0500 | [diff] [blame] | 132 | tracing_sched_wakeup_trace(ctx_trace, wakee, current, |
Steven Rostedt | 3869705 | 2008-10-01 13:14:09 -0400 | [diff] [blame] | 133 | flags, pc); |
Ingo Molnar | 5742279 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 134 | |
Ingo Molnar | 5742279 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 135 | local_irq_restore(flags); |
| 136 | } |
| 137 | |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 138 | static int tracing_sched_register(void) |
| 139 | { |
| 140 | int ret; |
| 141 | |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 142 | ret = register_trace_sched_wakeup(probe_sched_wakeup); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 143 | if (ret) { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 144 | pr_info("wakeup trace: Couldn't activate tracepoint" |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 145 | " probe to kernel_sched_wakeup\n"); |
| 146 | return ret; |
| 147 | } |
| 148 | |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 149 | ret = register_trace_sched_wakeup_new(probe_sched_wakeup); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 150 | if (ret) { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 151 | pr_info("wakeup trace: Couldn't activate tracepoint" |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 152 | " probe to kernel_sched_wakeup_new\n"); |
| 153 | goto fail_deprobe; |
| 154 | } |
| 155 | |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 156 | ret = register_trace_sched_switch(probe_sched_switch); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 157 | if (ret) { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 158 | pr_info("sched trace: Couldn't activate tracepoint" |
Wenji Huang | 73d8b8b | 2009-02-17 01:10:02 -0500 | [diff] [blame] | 159 | " probe to kernel_sched_switch\n"); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 160 | goto fail_deprobe_wake_new; |
| 161 | } |
| 162 | |
| 163 | return ret; |
| 164 | fail_deprobe_wake_new: |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 165 | unregister_trace_sched_wakeup_new(probe_sched_wakeup); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 166 | fail_deprobe: |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 167 | unregister_trace_sched_wakeup(probe_sched_wakeup); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 168 | return ret; |
| 169 | } |
| 170 | |
| 171 | static void tracing_sched_unregister(void) |
| 172 | { |
Mathieu Desnoyers | b07c3f1 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 173 | unregister_trace_sched_switch(probe_sched_switch); |
| 174 | unregister_trace_sched_wakeup_new(probe_sched_wakeup); |
| 175 | unregister_trace_sched_wakeup(probe_sched_wakeup); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 176 | } |
| 177 | |
Ingo Molnar | f225293 | 2008-05-22 10:37:48 +0200 | [diff] [blame] | 178 | static void tracing_start_sched_switch(void) |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 179 | { |
Frederic Weisbecker | efade6e | 2008-10-31 13:28:58 +0100 | [diff] [blame] | 180 | mutex_lock(&sched_register_mutex); |
Steven Rostedt | e168e05 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 181 | if (!(sched_ref++)) |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 182 | tracing_sched_register(); |
Frederic Weisbecker | efade6e | 2008-10-31 13:28:58 +0100 | [diff] [blame] | 183 | mutex_unlock(&sched_register_mutex); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 184 | } |
| 185 | |
Ingo Molnar | f225293 | 2008-05-22 10:37:48 +0200 | [diff] [blame] | 186 | static void tracing_stop_sched_switch(void) |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 187 | { |
Frederic Weisbecker | efade6e | 2008-10-31 13:28:58 +0100 | [diff] [blame] | 188 | mutex_lock(&sched_register_mutex); |
Steven Rostedt | e168e05 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 189 | if (!(--sched_ref)) |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 190 | tracing_sched_unregister(); |
Frederic Weisbecker | efade6e | 2008-10-31 13:28:58 +0100 | [diff] [blame] | 191 | mutex_unlock(&sched_register_mutex); |
Mathieu Desnoyers | 5b82a1b | 2008-05-12 21:21:10 +0200 | [diff] [blame] | 192 | } |
| 193 | |
Steven Rostedt | 41bc814 | 2008-05-22 11:49:22 -0400 | [diff] [blame] | 194 | void tracing_start_cmdline_record(void) |
| 195 | { |
| 196 | tracing_start_sched_switch(); |
| 197 | } |
| 198 | |
| 199 | void tracing_stop_cmdline_record(void) |
| 200 | { |
| 201 | tracing_stop_sched_switch(); |
| 202 | } |
| 203 | |
Steven Rostedt | 75f5c47 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 204 | /** |
Steven Rostedt | e168e05 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 205 | * tracing_start_sched_switch_record - start tracing context switches |
| 206 | * |
| 207 | * Turns on context switch tracing for a tracer. |
| 208 | */ |
| 209 | void tracing_start_sched_switch_record(void) |
| 210 | { |
| 211 | if (unlikely(!ctx_trace)) { |
| 212 | WARN_ON(1); |
| 213 | return; |
| 214 | } |
| 215 | |
| 216 | tracing_start_sched_switch(); |
| 217 | |
| 218 | mutex_lock(&sched_register_mutex); |
| 219 | tracer_enabled++; |
| 220 | mutex_unlock(&sched_register_mutex); |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * tracing_stop_sched_switch_record - start tracing context switches |
| 225 | * |
| 226 | * Turns off context switch tracing for a tracer. |
| 227 | */ |
| 228 | void tracing_stop_sched_switch_record(void) |
| 229 | { |
| 230 | mutex_lock(&sched_register_mutex); |
| 231 | tracer_enabled--; |
| 232 | WARN_ON(tracer_enabled < 0); |
| 233 | mutex_unlock(&sched_register_mutex); |
| 234 | |
| 235 | tracing_stop_sched_switch(); |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * tracing_sched_switch_assign_trace - assign a trace array for ctx switch |
Steven Rostedt | 75f5c47 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 240 | * @tr: trace array pointer to assign |
| 241 | * |
| 242 | * Some tracers might want to record the context switches in their |
| 243 | * trace. This function lets those tracers assign the trace array |
| 244 | * to use. |
| 245 | */ |
Steven Rostedt | e168e05 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 246 | void tracing_sched_switch_assign_trace(struct trace_array *tr) |
Steven Rostedt | 75f5c47 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 247 | { |
| 248 | ctx_trace = tr; |
| 249 | } |
| 250 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 251 | static void stop_sched_trace(struct trace_array *tr) |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 252 | { |
Steven Rostedt | e168e05 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 253 | tracing_stop_sched_switch_record(); |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 254 | } |
| 255 | |
Frederic Weisbecker | 1c80025 | 2008-11-16 05:57:26 +0100 | [diff] [blame] | 256 | static int sched_switch_trace_init(struct trace_array *tr) |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 257 | { |
| 258 | ctx_trace = tr; |
Steven Rostedt | 5fec6dd | 2009-03-17 19:59:53 -0400 | [diff] [blame] | 259 | tracing_reset_online_cpus(tr); |
Arnaldo Carvalho de Melo | b6f11df | 2009-02-05 18:02:00 -0200 | [diff] [blame] | 260 | tracing_start_sched_switch_record(); |
Frederic Weisbecker | 1c80025 | 2008-11-16 05:57:26 +0100 | [diff] [blame] | 261 | return 0; |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 262 | } |
| 263 | |
Ingo Molnar | e309b41 | 2008-05-12 21:20:51 +0200 | [diff] [blame] | 264 | static void sched_switch_trace_reset(struct trace_array *tr) |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 265 | { |
Steven Rostedt | c76f069 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 266 | if (sched_ref) |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 267 | stop_sched_trace(tr); |
| 268 | } |
| 269 | |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 270 | static void sched_switch_trace_start(struct trace_array *tr) |
| 271 | { |
Steven Rostedt | 5fec6dd | 2009-03-17 19:59:53 -0400 | [diff] [blame] | 272 | sched_stopped = 0; |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | static void sched_switch_trace_stop(struct trace_array *tr) |
| 276 | { |
Steven Rostedt | 5fec6dd | 2009-03-17 19:59:53 -0400 | [diff] [blame] | 277 | sched_stopped = 1; |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 278 | } |
| 279 | |
Steven Rostedt | 75f5c47 | 2008-11-07 22:36:02 -0500 | [diff] [blame] | 280 | static struct tracer sched_switch_trace __read_mostly = |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 281 | { |
| 282 | .name = "sched_switch", |
| 283 | .init = sched_switch_trace_init, |
| 284 | .reset = sched_switch_trace_reset, |
Steven Rostedt | 9036990 | 2008-11-05 16:05:44 -0500 | [diff] [blame] | 285 | .start = sched_switch_trace_start, |
| 286 | .stop = sched_switch_trace_stop, |
Frederic Weisbecker | 6eaaa5d | 2009-02-11 02:25:00 +0100 | [diff] [blame] | 287 | .wait_pipe = poll_wait_pipe, |
Steven Rostedt | 60a1177 | 2008-05-12 21:20:44 +0200 | [diff] [blame] | 288 | #ifdef CONFIG_FTRACE_SELFTEST |
| 289 | .selftest = trace_selftest_startup_sched_switch, |
| 290 | #endif |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 291 | }; |
| 292 | |
| 293 | __init static int init_sched_switch_trace(void) |
| 294 | { |
Steven Rostedt | 35e8e30 | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 295 | return register_tracer(&sched_switch_trace); |
| 296 | } |
| 297 | device_initcall(init_sched_switch_trace); |
Ingo Molnar | c71dd42 | 2008-12-19 01:09:51 +0100 | [diff] [blame] | 298 | |