diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-05-12 15:20:52 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-23 15:04:44 -0400 |
commit | 4e65551905fb0300ae7e667cbaa41ee2e3f29a13 (patch) | |
tree | 0e642c311e31043eecf86c218128c40e1ddac782 /kernel/sched.c | |
parent | 4c1f4d4f0175129934d5dbc19a39296430937a05 (diff) |
ftrace: sched tracer, trace full rbtree
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 53ab1174664f..b9208a0e33a0 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2394,6 +2394,35 @@ static int sched_balance_self(int cpu, int flag) | |||
2394 | 2394 | ||
2395 | #endif /* CONFIG_SMP */ | 2395 | #endif /* CONFIG_SMP */ |
2396 | 2396 | ||
2397 | #ifdef CONFIG_CONTEXT_SWITCH_TRACER | ||
2398 | |||
2399 | void ftrace_all_fair_tasks(void *__rq, void *__tr, void *__data) | ||
2400 | { | ||
2401 | struct sched_entity *se; | ||
2402 | struct task_struct *p; | ||
2403 | struct rb_node *curr; | ||
2404 | struct rq *rq = __rq; | ||
2405 | |||
2406 | curr = first_fair(&rq->cfs); | ||
2407 | if (!curr) | ||
2408 | return; | ||
2409 | |||
2410 | while (curr) { | ||
2411 | se = rb_entry(curr, struct sched_entity, run_node); | ||
2412 | if (!entity_is_task(se)) | ||
2413 | continue; | ||
2414 | |||
2415 | p = task_of(se); | ||
2416 | |||
2417 | __trace_special(__tr, __data, | ||
2418 | p->pid, p->se.vruntime, p->se.sum_exec_runtime); | ||
2419 | |||
2420 | curr = rb_next(curr); | ||
2421 | } | ||
2422 | } | ||
2423 | |||
2424 | #endif | ||
2425 | |||
2397 | /*** | 2426 | /*** |
2398 | * try_to_wake_up - wake up a thread | 2427 | * try_to_wake_up - wake up a thread |
2399 | * @p: the to-be-woken-up thread | 2428 | * @p: the to-be-woken-up thread |
@@ -2468,7 +2497,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync) | |||
2468 | 2497 | ||
2469 | out_activate: | 2498 | out_activate: |
2470 | #endif /* CONFIG_SMP */ | 2499 | #endif /* CONFIG_SMP */ |
2471 | ftrace_wake_up_task(p, rq->curr); | 2500 | ftrace_wake_up_task(rq, p, rq->curr); |
2472 | schedstat_inc(p, se.nr_wakeups); | 2501 | schedstat_inc(p, se.nr_wakeups); |
2473 | if (sync) | 2502 | if (sync) |
2474 | schedstat_inc(p, se.nr_wakeups_sync); | 2503 | schedstat_inc(p, se.nr_wakeups_sync); |
@@ -2613,7 +2642,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags) | |||
2613 | p->sched_class->task_new(rq, p); | 2642 | p->sched_class->task_new(rq, p); |
2614 | inc_nr_running(rq); | 2643 | inc_nr_running(rq); |
2615 | } | 2644 | } |
2616 | ftrace_wake_up_task(p, rq->curr); | 2645 | ftrace_wake_up_task(rq, p, rq->curr); |
2617 | check_preempt_curr(rq, p); | 2646 | check_preempt_curr(rq, p); |
2618 | #ifdef CONFIG_SMP | 2647 | #ifdef CONFIG_SMP |
2619 | if (p->sched_class->task_wake_up) | 2648 | if (p->sched_class->task_wake_up) |
@@ -2786,7 +2815,7 @@ context_switch(struct rq *rq, struct task_struct *prev, | |||
2786 | struct mm_struct *mm, *oldmm; | 2815 | struct mm_struct *mm, *oldmm; |
2787 | 2816 | ||
2788 | prepare_task_switch(rq, prev, next); | 2817 | prepare_task_switch(rq, prev, next); |
2789 | ftrace_ctx_switch(prev, next); | 2818 | ftrace_ctx_switch(rq, prev, next); |
2790 | mm = next->mm; | 2819 | mm = next->mm; |
2791 | oldmm = prev->active_mm; | 2820 | oldmm = prev->active_mm; |
2792 | /* | 2821 | /* |