From f44a1c693faad61e7b4d5d7f11874937cba84ce1 Mon Sep 17 00:00:00 2001 From: Johnlay Park Date: Fri, 2 Mar 2018 13:32:13 +0900 Subject: [PATCH] [COMMON] sched/rt: trace: add tracepoint for RT task Change-Id: I82c5fe708671e00b8f655f40459272c0dcc8b584 Signed-off-by: Johnlay Park --- include/trace/events/sched.h | 85 ++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 7cf6918c558b..e668c0e2bc87 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -637,6 +637,91 @@ struct cfs_rq *__trace_sched_group_cfs_rq(struct sched_entity *se) } #endif /* CREATE_TRACE_POINTS */ +/* + * Tracepoint for accounting sched averages for fair tasks. + */ +TRACE_EVENT(sched_load_avg_task, + + TP_PROTO(struct task_struct *tsk, struct sched_avg *avg), + + TP_ARGS(tsk, avg), + + TP_STRUCT__entry( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) + __field( int, cpu ) + __field( unsigned long, load_avg ) + __field( unsigned long, util_avg ) + __field( u64, load_sum ) + __field( u32, util_sum ) + __field( u32, period_contrib ) + ), + + TP_fast_assign( + memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); + __entry->pid = tsk->pid; + __entry->cpu = task_cpu(tsk); + __entry->load_avg = avg->load_avg; + __entry->util_avg = avg->util_avg; + __entry->load_sum = avg->load_sum; + __entry->util_sum = avg->util_sum; + __entry->period_contrib = avg->period_contrib; + ), + TP_printk("fair: comm=%s pid=%d cpu=%d load_avg=%lu util_avg=%lu " + "load_sum=%llu util_sum=%u period_contrib=%u", + __entry->comm, + __entry->pid, + __entry->cpu, + __entry->load_avg, + __entry->util_avg, + (u64)__entry->load_sum, + (u32)__entry->util_sum, + (u32)__entry->period_contrib) +); + +/* + * Tracepoint for accounting sched averages for tasks. + */ +TRACE_EVENT(sched_rt_load_avg_task, + + TP_PROTO(struct task_struct *tsk, struct sched_avg *avg), + + TP_ARGS(tsk, avg), + + TP_STRUCT__entry( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) + __field( int, cpu ) + __field( unsigned long, load_avg ) + __field( unsigned long, util_avg ) + __field( u64, load_sum ) + __field( u32, util_sum ) + __field( u32, period_contrib ) + ), + + TP_fast_assign( + memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); + __entry->pid = tsk->pid; + __entry->cpu = task_cpu(tsk); + __entry->load_avg = avg->load_avg; + __entry->util_avg = avg->util_avg; + __entry->load_sum = avg->load_sum; + __entry->util_sum = avg->util_sum; + __entry->period_contrib = avg->period_contrib; + ), + TP_printk("rt: comm=%s pid=%d cpu=%d load_avg=%lu util_avg=%lu " + "load_sum=%llu util_sum=%u period_contrib=%u", + __entry->comm, + __entry->pid, + __entry->cpu, + __entry->load_avg, + __entry->util_avg, + (u64)__entry->load_sum, + (u32)__entry->util_sum, + (u32)__entry->period_contrib) +); + + /* * Tracepoint for cfs_rq load tracking: */ -- 2.20.1