DEBUG: sched/tune: add tracepoint on P-E space filtering
authorPatrick Bellasi <patrick.bellasi@arm.com>
Wed, 20 Jan 2016 14:06:05 +0000 (14:06 +0000)
committerJohn Stultz <john.stultz@linaro.org>
Wed, 10 Aug 2016 22:07:28 +0000 (15:07 -0700)
Change-Id: I31dfed67c0486713b88efb75df767329f2802e06
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
include/trace/events/sched.h
kernel/sched/tune.c

index 13fb31cebf62d778118ea42df04f31c41bec4213..cb082a68cdd68eebd8cebb14669c099a981ebd5b 100644 (file)
@@ -851,6 +851,41 @@ TRACE_EVENT(sched_energy_diff,
                __entry->nrgn, __entry->nrgp)
 );
 
+/*
+ * Tracepoint for schedtune_tasks_update
+ */
+TRACE_EVENT(sched_tune_filter,
+
+       TP_PROTO(int nrg_delta, int cap_delta,
+                int nrg_gain,  int cap_gain,
+                int payoff, int region),
+
+       TP_ARGS(nrg_delta, cap_delta, nrg_gain, cap_gain, payoff, region),
+
+       TP_STRUCT__entry(
+               __field( int,   nrg_delta       )
+               __field( int,   cap_delta       )
+               __field( int,   nrg_gain        )
+               __field( int,   cap_gain        )
+               __field( int,   payoff          )
+               __field( int,   region          )
+       ),
+
+       TP_fast_assign(
+               __entry->nrg_delta      = nrg_delta;
+               __entry->cap_delta      = cap_delta;
+               __entry->nrg_gain       = nrg_gain;
+               __entry->cap_gain       = cap_gain;
+               __entry->payoff         = payoff;
+               __entry->region         = region;
+       ),
+
+       TP_printk("nrg_delta=%d cap_delta=%d nrg_gain=%d cap_gain=%d payoff=%d region=%d",
+               __entry->nrg_delta, __entry->cap_delta,
+               __entry->nrg_gain, __entry->cap_gain,
+               __entry->payoff, __entry->region)
+);
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
index 7a434f2394e7ba9932809ebb4e449c42869cf551..b40d40dc3c49a4bd5227b09989cb8bb6c41af163 100644 (file)
@@ -70,6 +70,13 @@ __schedtune_accept_deltas(int nrg_delta, int cap_delta,
                 */
                payoff  = nrg_delta * threshold_gains[perf_boost_idx].cap_gain;
                payoff -= cap_delta * threshold_gains[perf_boost_idx].nrg_gain;
+
+               trace_sched_tune_filter(
+                               nrg_delta, cap_delta,
+                               threshold_gains[perf_boost_idx].nrg_gain,
+                               threshold_gains[perf_boost_idx].cap_gain,
+                               payoff, 8);
+
                return payoff;
        }
 
@@ -84,6 +91,13 @@ __schedtune_accept_deltas(int nrg_delta, int cap_delta,
                 */
                payoff  = cap_delta * threshold_gains[perf_constrain_idx].nrg_gain;
                payoff -= nrg_delta * threshold_gains[perf_constrain_idx].cap_gain;
+
+               trace_sched_tune_filter(
+                               nrg_delta, cap_delta,
+                               threshold_gains[perf_constrain_idx].nrg_gain,
+                               threshold_gains[perf_constrain_idx].cap_gain,
+                               payoff, 6);
+
                return payoff;
        }
 
@@ -155,12 +169,16 @@ schedtune_accept_deltas(int nrg_delta, int cap_delta,
        int perf_constrain_idx;
 
        /* Optimal (O) region */
-       if (nrg_delta < 0 && cap_delta > 0)
+       if (nrg_delta < 0 && cap_delta > 0) {
+               trace_sched_tune_filter(nrg_delta, cap_delta, 0, 0, 1, 0);
                return INT_MAX;
+       }
 
        /* Suboptimal (S) region */
-       if (nrg_delta > 0 && cap_delta < 0)
+       if (nrg_delta > 0 && cap_delta < 0) {
+               trace_sched_tune_filter(nrg_delta, cap_delta, 0, 0, -1, 5);
                return -INT_MAX;
+       }
 
        /* Get task specific perf Boost/Constraints indexes */
        rcu_read_lock();
@@ -531,12 +549,16 @@ schedtune_accept_deltas(int nrg_delta, int cap_delta,
                        struct task_struct *task)
 {
        /* Optimal (O) region */
-       if (nrg_delta < 0 && cap_delta > 0)
+       if (nrg_delta < 0 && cap_delta > 0) {
+               trace_sched_tune_filter(nrg_delta, cap_delta, 0, 0, 1, 0);
                return INT_MAX;
+       }
 
        /* Suboptimal (S) region */
-       if (nrg_delta > 0 && cap_delta < 0)
+       if (nrg_delta > 0 && cap_delta < 0) {
+               trace_sched_tune_filter(nrg_delta, cap_delta, 0, 0, -1, 5);
                return -INT_MAX;
+       }
 
        return __schedtune_accept_deltas(nrg_delta, cap_delta,
                        perf_boost_idx, perf_constrain_idx);