diff options
| author | Patrick Bellasi <patrick.bellasi@arm.com> | 2017-06-29 12:24:27 +0100 |
|---|---|---|
| committer | Chris Redpath <chris.redpath@arm.com> | 2017-07-25 16:31:00 +0100 |
| commit | bf6cd4d156b7b4ef09d00de92616eef49bb0efc7 (patch) | |
| tree | 0817f284de2f680521d3fcdb46bebc9e16528546 | |
| parent | 5680f23f20c73f6348fe73dc23a025a965d69e28 (diff) | |
events: add tracepoint for find_best_target
Change-Id: I4c245ffacb207d7ea826c5763a426efe5399e0a2
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
| -rw-r--r-- | include/trace/events/sched.h | 42 | ||||
| -rw-r--r-- | kernel/sched/fair.c | 10 |
2 files changed, 52 insertions, 0 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 433d3919ba00..8b97464803f1 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -878,6 +878,48 @@ TRACE_EVENT(sched_boost_task, ); /* + * Tracepoint for find_best_target + */ +TRACE_EVENT(sched_find_best_target, + + TP_PROTO(struct task_struct *tsk, bool prefer_idle, + unsigned long min_util, int start_cpu, + int best_idle, int best_active, int target), + + TP_ARGS(tsk, prefer_idle, min_util, start_cpu, + best_idle, best_active, target), + + TP_STRUCT__entry( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) + __field( unsigned long, min_util ) + __field( bool, prefer_idle ) + __field( int, start_cpu ) + __field( int, best_idle ) + __field( int, best_active ) + __field( int, target ) + ), + + TP_fast_assign( + memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); + __entry->pid = tsk->pid; + __entry->min_util = min_util; + __entry->prefer_idle = prefer_idle; + __entry->start_cpu = start_cpu; + __entry->best_idle = best_idle; + __entry->best_active = best_active; + __entry->target = target; + ), + + TP_printk("pid=%d comm=%s prefer_idle=%d start_cpu=%d " + "best_idle=%d best_active=%d target=%d", + __entry->pid, __entry->comm, + __entry->prefer_idle, __entry->start_cpu, + __entry->best_idle, __entry->best_active, + __entry->target) +); + +/* * Tracepoint for accounting sched group energy */ TRACE_EVENT(sched_energy_diff, diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a61c47a030a0..e6336157feec 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6291,6 +6291,12 @@ static inline int find_best_target(struct task_struct *p, bool boosted, bool pre if (idle_cpu(i)) { schedstat_inc(p, se.statistics.nr_wakeups_fbt_pref_idle); schedstat_inc(this_rq(), eas_stats.fbt_pref_idle); + + trace_sched_find_best_target(p, + prefer_idle, min_util, + cpu, best_idle_cpu, + best_active_cpu, i); + return i; } @@ -6433,6 +6439,10 @@ static inline int find_best_target(struct task_struct *p, bool boosted, bool pre ? best_active_cpu : best_idle_cpu; + trace_sched_find_best_target(p, prefer_idle, min_util, cpu, + best_idle_cpu, best_active_cpu, + target_cpu); + schedstat_inc(p, se.statistics.nr_wakeups_fbt_count); schedstat_inc(this_rq(), eas_stats.fbt_count); |
