Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd330e9e authored by Saravana Kannan's avatar Saravana Kannan Committed by Rohit Gupta
Browse files

cpufreq: schedutil: Add tracepoints for debugging



Add trace points when load gets updated and when frequency is chosen
to facilitate better debugging.

Change-Id: Ib19911a03fc941bc7db76ab07394e152d0572871
Signed-off-by: default avatarSaravana Kannan <skannan@codeaurora.org>
Signed-off-by: default avatarRohit Gupta <rohgup@codeaurora.org>
[Fix some conflicts introduced by reordering this patch]
Signed-off-by: default avatarJonathan Avila <avilaj@codeaurora.org>
parent 895be7d7
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line
@@ -590,6 +590,60 @@ DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,

	TP_ARGS(name, type, new_value)
);

TRACE_EVENT(sugov_util_update,
	    TP_PROTO(int cpu,
		     unsigned long util, unsigned long avg_cap,
		     unsigned long max_cap, unsigned long nl, unsigned long pl,
		     unsigned int flags),
	    TP_ARGS(cpu, util, avg_cap, max_cap, nl, pl, flags),
	    TP_STRUCT__entry(
		    __field(	int,		cpu)
		    __field(	unsigned long,	util)
		    __field(	unsigned long,	avg_cap)
		    __field(	unsigned long,	max_cap)
		    __field(	unsigned long,	nl)
		    __field(	unsigned long,	pl)
		    __field(	unsigned int,	flags)
	    ),
	    TP_fast_assign(
		    __entry->cpu = cpu;
		    __entry->util = util;
		    __entry->avg_cap = avg_cap;
		    __entry->max_cap = max_cap;
		    __entry->nl = nl;
		    __entry->pl = pl;
		    __entry->flags = flags;
	    ),
	    TP_printk("cpu=%d util=%lu avg_cap=%lu max_cap=%lu nl=%lu pl=%lu flags=0x%x",
		      __entry->cpu, __entry->util, __entry->avg_cap,
		      __entry->max_cap, __entry->nl,
		      __entry->pl, __entry->flags)
);

TRACE_EVENT(sugov_next_freq,
	    TP_PROTO(unsigned int cpu, unsigned long util, unsigned long max,
		     unsigned int freq),
	    TP_ARGS(cpu, util, max, freq),
	    TP_STRUCT__entry(
		    __field(	unsigned int,	cpu)
		    __field(	unsigned long,	util)
		    __field(	unsigned long,	max)
		    __field(	unsigned int,	freq)
	    ),
	    TP_fast_assign(
		    __entry->cpu = cpu;
		    __entry->util = util;
		    __entry->max = max;
		    __entry->freq = freq;
	    ),
	    TP_printk("cpu=%u util=%lu max=%lu freq=%u",
		      __entry->cpu,
		      __entry->util,
		      __entry->max,
		      __entry->freq)
);

#endif /* _TRACE_POWER_H */

/* This part must be outside protection */
+9 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
				policy->cpuinfo.max_freq : policy->cur;

	freq = (freq + (freq >> 2)) * util / max;
	trace_sugov_next_freq(policy->cpu, util, max, freq);

	if (freq == sg_policy->cached_raw_freq && sg_policy->next_freq != UINT_MAX)
		return sg_policy->next_freq;
@@ -375,6 +376,10 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
		sg_cpu->max = max;
		sg_cpu->flags = flags;

		trace_sugov_util_update(sg_cpu->cpu, sg_cpu->util,
				sg_policy->avg_cap, max, sg_cpu->walt_load.nl,
				sg_cpu->walt_load.pl, flags);

		sugov_iowait_boost(sg_cpu, &util, &max);
		sugov_calc_avg_cap(sg_policy, sg_cpu->walt_load.ws,
				   sg_policy->policy->cur);
@@ -477,6 +482,10 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time,
	sugov_calc_avg_cap(sg_policy, sg_cpu->walt_load.ws,
			   sg_policy->policy->cur);

	trace_sugov_util_update(sg_cpu->cpu, sg_cpu->util, sg_policy->avg_cap,
				max, sg_cpu->walt_load.nl,
				sg_cpu->walt_load.pl, flags);

	if (sugov_should_update_freq(sg_policy, time)) {
		if (flags & SCHED_CPUFREQ_RT_DL)
			next_f = sg_policy->policy->cpuinfo.max_freq;