[RFC][PATCH 5/5] [PATCH 5/5] tracing/events: Add sched_migrate_task stable event

Steven Rostedt
2010-11-17T01:00:05Z

[-- Attachment #1: 0005-tracing-events-Add-sched_migrate_task-stable-event.patch --]
[-- Type: text/plain, Size: 1743 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Add the stable event for sched_migrate_task.

[root@bxf ~]# cat /sys/kernel/event/sched_migrate_task/format
array:comm type:char size:8 count:16 align:1 signed:1;
field:pid type:pid_t size:32 align:4 signed:1;
field:orig_cpu type:int size:32 align:4 signed:1;
field:dest_cpu type:int size:32 align:4 signed:1;

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/trace/stable/sched.h | 13 +++++++++++++
kernel/events/events.c | 10 ++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/include/trace/stable/sched.h b/include/trace/stable/sched.h
index b5f4fd7..55d0e6f 100644
--- a/include/trace/stable/sched.h
+++ b/include/trace/stable/sched.h
@@ -17,4 +17,17 @@ STABLE_EVENT(sched_switch,
)
);

+/*
+ * Tracepoint for a task being migrated:
+ */
+STABLE_EVENT(sched_migrate_task,
+
+ EVENT_STRUCT(
+ __array( char, comm, TASK_COMM_LEN )__SEP__
+ __field( pid_t, pid )__SEP__
+ __field( int, orig_cpu )__SEP__
+ __field( int, dest_cpu )
+ )
+);
+
#endif /* _STABLE_SCHED_H */
diff --git a/kernel/events/events.c b/kernel/events/events.c
index f69e720..6ca2d2d 100644
--- a/kernel/events/events.c
+++ b/kernel/events/events.c
@@ -35,4 +35,14 @@ static void hook_sched_switch(void *ignore,
next->comm, next->pid);
}

+DECLARE_TRACE(stable_sched_migrate_task,
+ TP_PROTO(char *comm, pid_t pid, int orig_cpu, int dest_cpu),
+ TP_ARGS(comm, pid, orig_cpu, dest_cpu));
+DEFINE_TRACE(stable_sched_migrate_task);
+
+static void hook_sched_migrate_task(void *ignore, struct task_struct *p, int dest_cpu)
+{
+ trace_stable_sched_migrate_task(p->comm, p->pid, task_cpu(p), dest_cpu);
+}
+
#include "event_reg.h"
--
1.7.1