tracing: Add tracepoints for cluster switch
Antti P Miettinen [Mon, 2 Apr 2012 11:27:21 +0000 (14:27 +0300)]
Simple trace points for measuring cluster switch latencies.

Bug 958262

Change-Id: Ia1e5e13131d5e55aaa0a44e9e8b5196539df54e7
Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Reviewed-on: http://git-master/r/93841
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

arch/arm/mach-tegra/pm.c
include/trace/events/power.h

index 733e18a..d59cf4e 100644 (file)
@@ -46,6 +46,8 @@
 #include <linux/export.h>
 #include <linux/tegra_audio.h>
 
+#include <trace/events/power.h>
+
 #include <asm/cacheflush.h>
 #include <asm/hardware/gic.h>
 #include <asm/idmap.h>
@@ -536,6 +538,7 @@ unsigned int tegra_idle_lp2_last(unsigned int sleep_time, unsigned int flags)
         * are in LP2 state and irqs are disabled
         */
        if (flags & TEGRA_POWER_CLUSTER_MASK) {
+               trace_cpu_cluster(POWER_CPU_CLUSTER_START);
                set_power_timers(pdata->cpu_timer, 0,
                        clk_get_rate_all_locked(tegra_pclk));
                tegra_cluster_switch_prolog(mode);
@@ -572,9 +575,10 @@ unsigned int tegra_idle_lp2_last(unsigned int sleep_time, unsigned int flags)
        if (sleep_time)
                tegra_lp2_set_trigger(0);
 
-       if (flags & TEGRA_POWER_CLUSTER_MASK)
+       if (flags & TEGRA_POWER_CLUSTER_MASK) {
                tegra_cluster_switch_epilog(mode);
-
+               trace_cpu_cluster(POWER_CPU_CLUSTER_DONE);
+       }
        tegra_cluster_switch_time(flags, tegra_cluster_switch_time_id_epilog);
 
 #if INSTRUMENT_CLUSTER_SWITCH
index babd8ae..4da1473 100644 (file)
@@ -52,6 +52,11 @@ enum {
        POWER_CPU_SCALE_DONE,
 };
 
+enum {
+       POWER_CPU_CLUSTER_START,
+       POWER_CPU_CLUSTER_DONE,
+};
+
 #endif
 
 TRACE_EVENT(cpu_hotplug,
@@ -99,6 +104,24 @@ TRACE_EVENT(cpu_scale,
                  (unsigned long)__entry->state)
 );
 
+TRACE_EVENT(cpu_cluster,
+
+       TP_PROTO(int state),
+
+       TP_ARGS(state),
+
+       TP_STRUCT__entry(
+               __field(u64, state)
+       ),
+
+       TP_fast_assign(
+               __entry->state = state;
+       ),
+
+       TP_printk("state=%lu",
+                 (unsigned long)__entry->state)
+);
+
 DEFINE_EVENT(cpu, cpu_frequency,
 
        TP_PROTO(unsigned int frequency, unsigned int cpu_id),