aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_sched_wakeup.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-01-21 16:24:46 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-22 04:27:22 -0500
commit3244351c31211a8b1ba8b4b34c3de04d5dfa03e4 (patch)
treef5b485f3c7f8375002c93dabaf577b14d5a2d2eb /kernel/trace/trace_sched_wakeup.c
parent97b17efe4537e11bf6669106cfe4ee2c5331b267 (diff)
trace: separate out rt tasks from wakeup tracer
Impact: add option to trace all tasks or just RT tasks The current wakeup tracer only traces RT task wakeups. This is fine for those interested in wake up timings of RT tasks, but it is useless for those that are interested in the causes of long wakeups for non RT tasks. This patch creates a "wakeup_rt" to implement the tracing of just RT tasks (as the current "wakeup" does). And makes "wakeup" now trace all tasks as an average developer would expect. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_sched_wakeup.c')
-rw-r--r--kernel/trace/trace_sched_wakeup.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
index e27adef0171a..f48957886102 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -25,6 +25,7 @@ static int __read_mostly tracer_enabled;
25static struct task_struct *wakeup_task; 25static struct task_struct *wakeup_task;
26static int wakeup_cpu; 26static int wakeup_cpu;
27static unsigned wakeup_prio = -1; 27static unsigned wakeup_prio = -1;
28static int wakeup_rt;
28 29
29static raw_spinlock_t wakeup_lock = 30static raw_spinlock_t wakeup_lock =
30 (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; 31 (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
@@ -224,7 +225,7 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success)
224 tracing_record_cmdline(p); 225 tracing_record_cmdline(p);
225 tracing_record_cmdline(current); 226 tracing_record_cmdline(current);
226 227
227 if (likely(!rt_task(p)) || 228 if ((wakeup_rt && !rt_task(p)) ||
228 p->prio >= wakeup_prio || 229 p->prio >= wakeup_prio ||
229 p->prio >= current->prio) 230 p->prio >= current->prio)
230 return; 231 return;
@@ -321,7 +322,7 @@ static void stop_wakeup_tracer(struct trace_array *tr)
321 unregister_trace_sched_wakeup(probe_wakeup); 322 unregister_trace_sched_wakeup(probe_wakeup);
322} 323}
323 324
324static int wakeup_tracer_init(struct trace_array *tr) 325static int __wakeup_tracer_init(struct trace_array *tr)
325{ 326{
326 tracing_max_latency = 0; 327 tracing_max_latency = 0;
327 wakeup_trace = tr; 328 wakeup_trace = tr;
@@ -329,6 +330,18 @@ static int wakeup_tracer_init(struct trace_array *tr)
329 return 0; 330 return 0;
330} 331}
331 332
333static int wakeup_tracer_init(struct trace_array *tr)
334{
335 wakeup_rt = 0;
336 return __wakeup_tracer_init(tr);
337}
338
339static int wakeup_rt_tracer_init(struct trace_array *tr)
340{
341 wakeup_rt = 1;
342 return __wakeup_tracer_init(tr);
343}
344
332static void wakeup_tracer_reset(struct trace_array *tr) 345static void wakeup_tracer_reset(struct trace_array *tr)
333{ 346{
334 stop_wakeup_tracer(tr); 347 stop_wakeup_tracer(tr);
@@ -360,6 +373,19 @@ static struct tracer wakeup_tracer __read_mostly =
360#endif 373#endif
361}; 374};
362 375
376static struct tracer wakeup_rt_tracer __read_mostly =
377{
378 .name = "wakeup_rt",
379 .init = wakeup_rt_tracer_init,
380 .reset = wakeup_tracer_reset,
381 .start = wakeup_tracer_start,
382 .stop = wakeup_tracer_stop,
383 .print_max = 1,
384#ifdef CONFIG_FTRACE_SELFTEST
385 .selftest = trace_selftest_startup_wakeup,
386#endif
387};
388
363__init static int init_wakeup_tracer(void) 389__init static int init_wakeup_tracer(void)
364{ 390{
365 int ret; 391 int ret;
@@ -368,6 +394,10 @@ __init static int init_wakeup_tracer(void)
368 if (ret) 394 if (ret)
369 return ret; 395 return ret;
370 396
397 ret = register_tracer(&wakeup_rt_tracer);
398 if (ret)
399 return ret;
400
371 return 0; 401 return 0;
372} 402}
373device_initcall(init_wakeup_tracer); 403device_initcall(init_wakeup_tracer);