DEBUG: sched/tune: add tracepoint for energy_diff() values
authorPatrick Bellasi <patrick.bellasi@arm.com>
Thu, 14 Jan 2016 18:47:21 +0000 (18:47 +0000)
committerJohn Stultz <john.stultz@linaro.org>
Wed, 10 Aug 2016 22:07:07 +0000 (15:07 -0700)
Change-Id: Id8fafbd85f6d81248f322e073ee790a7ceec0bf7
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
include/trace/events/sched.h
kernel/sched/fair.c

index 60650950044601b4cd3eadbf13e7ce91031fe5c1..13fb31cebf62d778118ea42df04f31c41bec4213 100644 (file)
@@ -794,6 +794,63 @@ TRACE_EVENT(sched_boost_task,
                  __entry->margin)
 );
 
+/*
+ * Tracepoint for accounting sched group energy
+ */
+TRACE_EVENT(sched_energy_diff,
+
+       TP_PROTO(struct task_struct *tsk, int scpu, int dcpu, int udelta,
+               int nrgb, int nrga, int nrgd, int capb, int capa, int capd,
+               int nrgn, int nrgp),
+
+       TP_ARGS(tsk, scpu, dcpu, udelta,
+               nrgb, nrga, nrgd, capb, capa, capd,
+               nrgn, nrgp),
+
+       TP_STRUCT__entry(
+               __array( char,  comm,   TASK_COMM_LEN   )
+               __field( pid_t, pid     )
+               __field( int,   scpu    )
+               __field( int,   dcpu    )
+               __field( int,   udelta  )
+               __field( int,   nrgb    )
+               __field( int,   nrga    )
+               __field( int,   nrgd    )
+               __field( int,   capb    )
+               __field( int,   capa    )
+               __field( int,   capd    )
+               __field( int,   nrgn    )
+               __field( int,   nrgp    )
+       ),
+
+       TP_fast_assign(
+               memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+               __entry->pid            = tsk->pid;
+               __entry->scpu           = scpu;
+               __entry->dcpu           = dcpu;
+               __entry->udelta         = udelta;
+               __entry->nrgb           = nrgb;
+               __entry->nrga           = nrga;
+               __entry->nrgd           = nrgd;
+               __entry->capb           = capb;
+               __entry->capa           = capa;
+               __entry->capd           = capd;
+               __entry->nrgn           = nrgn;
+               __entry->nrgp           = nrgp;
+       ),
+
+       TP_printk("pid=%d comm=%s "
+                       "src_cpu=%d dst_cpu=%d usage_delta=%d "
+                       "nrg_before=%d nrg_after=%d nrg_diff=%d "
+                       "cap_before=%d cap_after=%d cap_delta=%d "
+                       "nrg_delta=%d nrg_payoff=%d",
+               __entry->pid, __entry->comm,
+               __entry->scpu, __entry->dcpu, __entry->udelta,
+               __entry->nrgb, __entry->nrga, __entry->nrgd,
+               __entry->capb, __entry->capa, __entry->capd,
+               __entry->nrgn, __entry->nrgp)
+);
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
index 3a1fd4d3a860a69e4f8c22c9f0480d6ebd509766..69cb6fb6793ea82e72f82b6b86b57c718ce653c5 100644 (file)
@@ -4998,6 +4998,7 @@ static int energy_diff(struct energy_env *eenv)
        struct sched_domain *sd;
        struct sched_group *sg;
        int sd_cpu = -1, energy_before = 0, energy_after = 0;
+       int result;
 
        struct energy_env eenv_before = {
                .util_delta     = 0,
@@ -5041,7 +5042,15 @@ static int energy_diff(struct energy_env *eenv)
        eenv->nrg.diff = eenv->nrg.after - eenv->nrg.before;
        eenv->payoff = 0;
 
-       return energy_diff_evaluate(eenv);
+       result = energy_diff_evaluate(eenv);
+
+       trace_sched_energy_diff(eenv->task,
+                       eenv->src_cpu, eenv->dst_cpu, eenv->util_delta,
+                       eenv->nrg.before, eenv->nrg.after, eenv->nrg.diff,
+                       eenv->cap.before, eenv->cap.after, eenv->cap.delta,
+                       eenv->nrg.delta, eenv->payoff);
+
+       return result;
 }
 
 /*