From 8e7389b5c2130b62ceafb7cc9d6a2ae00bfbcf5a Mon Sep 17 00:00:00 2001 From: Steve Muckle Date: Sun, 13 Apr 2014 14:05:30 -0700 Subject: sched: add affinity, task load information to sched tracepoints Knowing the affinity mask and CPU usage of a task is helpful in understanding the behavior of the system. Affinity information has been added to the enq_deq trace event, and the migration tracepoint now reports the load of the task migrated. Change-Id: I29d8a610292b4dfeeb8fe16174e9d4dc196649b7 Signed-off-by: Steve Muckle Signed-off-by: Syed Rameez Mustafa --- include/trace/events/sched.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'include/trace') diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index e9569c65330d..99f93e6a9235 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -57,9 +57,9 @@ TRACE_EVENT(sched_kthread_stop_ret, */ TRACE_EVENT(sched_enq_deq_task, - TP_PROTO(struct task_struct *p, int enqueue), + TP_PROTO(struct task_struct *p, int enqueue, unsigned int cpus_allowed), - TP_ARGS(p, enqueue), + TP_ARGS(p, enqueue, cpus_allowed), TP_STRUCT__entry( __array( char, comm, TASK_COMM_LEN ) @@ -70,6 +70,7 @@ TRACE_EVENT(sched_enq_deq_task, __field(unsigned int, nr_running ) __field(unsigned long, cpu_load ) __field(unsigned int, rt_nr_running ) + __field(unsigned int, cpus_allowed ) #ifdef CONFIG_SCHED_FREQ_INPUT __field(unsigned int, sum_scaled ) __field(unsigned int, period ) @@ -86,6 +87,7 @@ TRACE_EVENT(sched_enq_deq_task, __entry->nr_running = task_rq(p)->nr_running; __entry->cpu_load = task_rq(p)->cpu_load[0]; __entry->rt_nr_running = task_rq(p)->rt.rt_nr_running; + __entry->cpus_allowed = cpus_allowed; #ifdef CONFIG_SCHED_FREQ_INPUT __entry->sum_scaled = p->se.avg.runnable_avg_sum_scaled; __entry->period = p->se.avg.runnable_avg_period; @@ -93,15 +95,15 @@ TRACE_EVENT(sched_enq_deq_task, #endif ), - TP_printk("cpu=%d %s comm=%s pid=%d prio=%d nr_running=%u cpu_load=%lu rt_nr_running=%u" + TP_printk("cpu=%d %s comm=%s pid=%d prio=%d nr_running=%u cpu_load=%lu rt_nr_running=%u affine=%x" #ifdef CONFIG_SCHED_FREQ_INPUT - "sum_scaled=%u period=%u demand=%u" + " sum_scaled=%u period=%u demand=%u" #endif , __entry->cpu, __entry->enqueue ? "enqueue" : "dequeue", __entry->comm, __entry->pid, __entry->prio, __entry->nr_running, - __entry->cpu_load, __entry->rt_nr_running + __entry->cpu_load, __entry->rt_nr_running, __entry->cpus_allowed #ifdef CONFIG_SCHED_FREQ_INPUT , __entry->sum_scaled, __entry->period, __entry->demand #endif @@ -303,14 +305,16 @@ TRACE_EVENT(sched_switch, */ TRACE_EVENT(sched_migrate_task, - TP_PROTO(struct task_struct *p, int dest_cpu), + TP_PROTO(struct task_struct *p, int dest_cpu, + unsigned int load), - TP_ARGS(p, dest_cpu), + TP_ARGS(p, dest_cpu, load), TP_STRUCT__entry( __array( char, comm, TASK_COMM_LEN ) __field( pid_t, pid ) __field( int, prio ) + __field(unsigned int, load ) __field( int, orig_cpu ) __field( int, dest_cpu ) ), @@ -319,12 +323,13 @@ TRACE_EVENT(sched_migrate_task, memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; + __entry->load = load; __entry->orig_cpu = task_cpu(p); __entry->dest_cpu = dest_cpu; ), - TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d", - __entry->comm, __entry->pid, __entry->prio, + TP_printk("comm=%s pid=%d prio=%d load=%d orig_cpu=%d dest_cpu=%d", + __entry->comm, __entry->pid, __entry->prio, __entry->load, __entry->orig_cpu, __entry->dest_cpu) ); -- cgit v1.2.3