[PATCH 08/12] sched: add switch_in and tick tracepoints

Tejun Heo
2010-05-04T12:39:38Z

Define and add sched_switch_in and sched_tick tracepoints. Both are
colocated with perf event functions. These will be used to make perf
use tracepoints.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
include/trace/events/sched.h | 14 ++++++++++++++
kernel/sched.c | 4 ++--
2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index cfceb0b..2bed8de 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -220,6 +220,20 @@ DECLARE_EVENT_CLASS(sched_process_template,
);

/*
+ * Tracepoint for task switch in:
+ */
+DEFINE_EVENT(sched_process_template, sched_switch_in,
+ TP_PROTO(struct task_struct *p),
+ TP_ARGS(p));
+
+/*
+ * Tracepoint for scheduler tick:
+ */
+DEFINE_EVENT(sched_process_template, sched_tick,
+ TP_PROTO(struct task_struct *p),
+ TP_ARGS(p));
+
+/*
* Tracepoint for freeing a task:
*/
DEFINE_EVENT(sched_process_template, sched_process_free,
diff --git a/kernel/sched.c b/kernel/sched.c
index 1acec30..f70f9d7 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2827,7 +2827,7 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
finish_arch_switch(prev);
finish_lock_switch(rq, prev);

- SCHED_EVENT(NONE, sched_in, in, SE_ARGS(current));
+ SCHED_EVENT(switch_in, sched_in, in, SE_ARGS(current));
if (mm)
mmdrop(mm);
if (unlikely(prev_state == TASK_DEAD)) {
@@ -3529,7 +3529,7 @@ void scheduler_tick(void)
curr->sched_class->task_tick(rq, curr, 0);
raw_spin_unlock(&rq->lock);

- SCHED_EVENT(NONE, tick, NONE, SE_ARGS(curr));
+ SCHED_EVENT(tick, tick, NONE, SE_ARGS(curr));

#ifdef CONFIG_SMP
rq->idle_at_tick = idle_cpu(cpu);
--
1.6.4.2