DEBUG: schedtune: add tracepoint for schedtune_tasks_update() values
authorPatrick Bellasi <patrick.bellasi@arm.com>
Wed, 24 Jun 2015 14:36:08 +0000 (15:36 +0100)
committerLeo Yan <leo.yan@linaro.org>
Tue, 10 May 2016 08:54:43 +0000 (16:54 +0800)
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
include/trace/events/sched.h
kernel/sched/tune.c

index eb812071458bbdf1d452f96619866c69881aeeb8..7ec9dcfc701a4ac64f12090eaf4984b4850d019b 100644 (file)
@@ -702,6 +702,68 @@ TRACE_EVENT(sched_boost_cpu,
                  __entry->margin)
 );
 
+/*
+ * Tracepoint for schedtune_tasks_update
+ */
+TRACE_EVENT(sched_tune_tasks_update,
+
+       TP_PROTO(struct task_struct *tsk, int cpu, int tasks, int idx,
+               unsigned int boost, unsigned int max_boost),
+
+       TP_ARGS(tsk, cpu, tasks, idx, boost, max_boost),
+
+       TP_STRUCT__entry(
+               __array( char,  comm,   TASK_COMM_LEN   )
+               __field( pid_t,         pid             )
+               __field( int,           cpu             )
+               __field( int,           tasks           )
+               __field( int,           idx             )
+               __field( unsigned int,  boost           )
+               __field( unsigned int,  max_boost       )
+       ),
+
+       TP_fast_assign(
+               memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+               __entry->pid            = tsk->pid;
+               __entry->cpu            = cpu;
+               __entry->tasks          = tasks;
+               __entry->idx            = idx;
+               __entry->boost          = boost;
+               __entry->max_boost      = max_boost;
+       ),
+
+       TP_printk("pid=%d comm=%s "
+                       "cpu=%d tasks=%d idx=%d boost=%u max_boost=%u",
+               __entry->pid, __entry->comm,
+               __entry->cpu, __entry->tasks, __entry->idx,
+               __entry->boost, __entry->max_boost)
+);
+
+/*
+ * Tracepoint for schedtune_boostgroup_update
+ */
+TRACE_EVENT(sched_tune_boostgroup_update,
+
+       TP_PROTO(int cpu, int variation, int max_boost),
+
+       TP_ARGS(cpu, variation, max_boost),
+
+       TP_STRUCT__entry(
+               __field( int,   cpu             )
+               __field( int,   variation       )
+               __field( int,   max_boost       )
+       ),
+
+       TP_fast_assign(
+               __entry->cpu            = cpu;
+               __entry->variation      = variation;
+               __entry->max_boost      = max_boost;
+       ),
+
+       TP_printk("cpu=%d variation=%d max_boost=%d",
+               __entry->cpu, __entry->variation, __entry->max_boost)
+);
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
index f5f4c57efb9eb2f0704c7b8c9f16c224767b5e09..7a434f2394e7ba9932809ebb4e449c42869cf551 100644 (file)
@@ -264,12 +264,18 @@ schedtune_boostgroup_update(int idx, int boost)
                /* Check if this update increase current max */
                if (boost > cur_boost_max && bg->group[idx].tasks) {
                        bg->boost_max = boost;
+                       trace_sched_tune_boostgroup_update(cpu, 1, bg->boost_max);
                        continue;
                }
 
                /* Check if this update has decreased current max */
-               if (cur_boost_max == old_boost && old_boost > boost)
+               if (cur_boost_max == old_boost && old_boost > boost) {
                        schedtune_cpu_update(cpu);
+                       trace_sched_tune_boostgroup_update(cpu, -1, bg->boost_max);
+                       continue;
+               }
+
+               trace_sched_tune_boostgroup_update(cpu, 0, bg->boost_max);
        }
 
        return 0;
@@ -293,6 +299,10 @@ schedtune_tasks_update(struct task_struct *p, int cpu, int idx, int task_count)
        tasks = bg->group[idx].tasks;
        if (tasks == 1 || tasks == 0)
                schedtune_cpu_update(cpu);
+
+       trace_sched_tune_tasks_update(p, cpu, tasks, idx,
+                       bg->group[idx].boost, bg->boost_max);
+
 }
 
 /*