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

Commit 6287968d authored by yonghaih's avatar yonghaih
Browse files

cpufreq: record CPUFREQ stat for fast switch path



Original CPUFREQ stat recording is only for slow path, add it for
fast path.

Change-Id: I6f66cd686e6e96c4381db332600da60cbd399033
Signed-off-by: default avataryonghaih <yonghaih@codeaurora.org>
parent b8658fe7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1900,8 +1900,10 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
	target_freq = clamp_val(target_freq, policy->min, policy->max);

	ret = cpufreq_driver->fast_switch(policy, target_freq);
	if (ret)
	if (ret) {
		cpufreq_times_record_transition(policy, ret);
		cpufreq_stats_record_transition(policy, ret);
	}

	return ret;
}
+3 −8
Original line number Diff line number Diff line
@@ -30,11 +30,12 @@ struct cpufreq_stats {
static void cpufreq_stats_update(struct cpufreq_stats *stats)
{
	unsigned long long cur_time = get_jiffies_64();
	unsigned long flags;

	spin_lock(&cpufreq_stats_lock);
	spin_lock_irqsave(&cpufreq_stats_lock, flags);
	stats->time_in_state[stats->last_index] += cur_time - stats->last_time;
	stats->last_time = cur_time;
	spin_unlock(&cpufreq_stats_lock);
	spin_unlock_irqrestore(&cpufreq_stats_lock, flags);
}

static void cpufreq_stats_clear_table(struct cpufreq_stats *stats)
@@ -58,9 +59,6 @@ static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf)
	ssize_t len = 0;
	int i;

	if (policy->fast_switch_enabled)
		return 0;

	cpufreq_stats_update(stats);
	for (i = 0; i < stats->state_num; i++) {
		len += sprintf(buf + len, "%u %llu\n", stats->freq_table[i],
@@ -84,9 +82,6 @@ static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf)
	ssize_t len = 0;
	int i, j;

	if (policy->fast_switch_enabled)
		return 0;

	len += snprintf(buf + len, PAGE_SIZE - len, "   From  :    To\n");
	len += snprintf(buf + len, PAGE_SIZE - len, "         : ");
	for (i = 0; i < stats->state_num; i++) {