ANDROID: DEBUG: sched,cpufreq: add cpu_capacity change tracepoint
This is useful when we want to compare cpu utilization and
cpu curr capacity side by side.
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Andres Oportus <andresoportus@google.com>
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 19ea8f5..6a3d078 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -29,6 +29,7 @@
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
#include <linux/tick.h>
+#include <linux/sched.h>
#include <trace/events/power.h>
static LIST_HEAD(cpufreq_policy_list);
@@ -428,6 +429,7 @@
void cpufreq_freq_transition_begin(struct cpufreq_policy *policy,
struct cpufreq_freqs *freqs)
{
+ int cpu;
/*
* Catch double invocations of _begin() which lead to self-deadlock.
@@ -456,6 +458,8 @@
spin_unlock(&policy->transition_lock);
scale_freq_capacity(policy, freqs);
+ for_each_cpu(cpu, policy->cpus)
+ trace_cpu_capacity(capacity_curr_of(cpu), cpu);
cpufreq_notify_transition(policy, freqs, CPUFREQ_PRECHANGE);
}