msm: lpm-levels: Modify ftrace events to track latency/sleep time

cpuidle enter and exit ftrace events can mismatch if lpm driver falls
back after choosing a low power mode. Modify ftrace events to clearly
distinguish between cpu power select event and cpuidle enter event.

Change-Id: I81bc2b175264c6bdeec555b2b1271c0f40870b1b
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
This commit is contained in:
Maulik Shah 2015-06-05 12:44:14 +05:30
parent 8040f3bfca
commit 7f2c9922b1
2 changed files with 24 additions and 4 deletions

View File

@ -339,7 +339,7 @@ static int cpu_power_select(struct cpuidle_device *dev,
if (modified_time_us)
msm_pm_set_timer(modified_time_us);
trace_cpu_idle_enter(best_level, sleep_us, latency_us, next_event_us);
trace_cpu_power_select(best_level, sleep_us, latency_us, next_event_us);
return best_level;
}
@ -716,6 +716,7 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
sched_set_cpu_cstate(smp_processor_id(), idx + 1,
pwr_params->energy_overhead, pwr_params->latency_us);
trace_cpu_idle_enter(idx);
cpu_prepare(cluster, idx, true);
cluster_prepare(cluster, cpumask, idx, true);
@ -729,7 +730,6 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
update_debug_pc_event(CPU_EXIT, idx, success, 0xdeaffeed,
true);
lpm_stats_cpu_exit(idx, success);
trace_cpu_idle_exit(idx, success);
cluster_unprepare(cluster, cpumask, idx, true);
cpu_unprepare(cluster, idx, true);
@ -738,10 +738,11 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
time = ktime_to_ns(ktime_get()) - time;
do_div(time, 1000);
dev->last_residency = (int)time;
trace_cpu_idle_exit(idx, success);
exit:
local_irq_enable();
trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
local_irq_enable();
return idx;
}

View File

@ -18,7 +18,7 @@
#include <linux/tracepoint.h>
TRACE_EVENT(cpu_idle_enter,
TRACE_EVENT(cpu_power_select,
TP_PROTO(int index, u32 sleep_us, u32 latency, u32 next_event_us),
@ -42,6 +42,25 @@ TRACE_EVENT(cpu_idle_enter,
__entry->index, __entry->sleep_us, __entry->latency,
__entry->next_event_us)
);
TRACE_EVENT(cpu_idle_enter,
TP_PROTO(int index),
TP_ARGS(index),
TP_STRUCT__entry(
__field(int, index)
),
TP_fast_assign(
__entry->index = index;
),
TP_printk("idx:%d",
__entry->index)
);
TRACE_EVENT(cpu_idle_exit,
TP_PROTO(int index, bool success),