tracing: Add event for tracing power gating
Antti P Miettinen [Fri, 7 Sep 2012 10:56:36 +0000 (13:56 +0300)]
Define trace events for measuring power gating latencies.

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

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

index 01ec345..b1c2086 100644 (file)
@@ -132,18 +132,20 @@ static int tegra_idle_enter_lp2(struct cpuidle_device *dev,
        }
 
        /* cpu_idle calls us with IRQs disabled */
-       trace_printk("LP2 entry at %lu us\n",
-                    (unsigned long)readl(IO_ADDRESS(TEGRA_TMR1_BASE)
-                                         + TIMERUS_CNTR_1US));
+       trace_cpu_powergate_rcuidle((unsigned long)readl(
+                                           IO_ADDRESS(TEGRA_TMR1_BASE)
+                                           + TIMERUS_CNTR_1US),
+                                   POWER_CPU_POWERGATE_ENTRY);
 
        enter = ktime_get();
 
        tegra_cpu_idle_stats_lp2_ready(dev->cpu);
        entered_lp2 = tegra_idle_lp2(dev, state);
 
-       trace_printk("LP2 exit at %lu us\n",
-                    (unsigned long)readl(IO_ADDRESS(TEGRA_TMR1_BASE)
-                                         + TIMERUS_CNTR_1US));
+       trace_cpu_powergate_rcuidle((unsigned long)readl(
+                                           IO_ADDRESS(TEGRA_TMR1_BASE)
+                                           + TIMERUS_CNTR_1US),
+                                   POWER_CPU_POWERGATE_EXIT);
 
        exit = ktime_sub(ktime_get(), enter);
        us = ktime_to_us(exit);
index c0194bc..da89b1c 100644 (file)
@@ -62,6 +62,11 @@ enum {
        POWER_CPU_CLUSTER_DONE,
 };
 
+enum {
+       POWER_CPU_POWERGATE_ENTRY,
+       POWER_CPU_POWERGATE_EXIT,
+};
+
 #endif
 
 TRACE_EVENT(cpu_suspend,
@@ -144,6 +149,27 @@ TRACE_EVENT(cpu_cluster,
                  (unsigned long)__entry->state)
 );
 
+TRACE_EVENT(cpu_powergate,
+
+       TP_PROTO(unsigned int counter, int state),
+
+       TP_ARGS(counter, state),
+
+       TP_STRUCT__entry(
+               __field(u32, counter)
+               __field(u32, state)
+       ),
+
+       TP_fast_assign(
+               __entry->counter = counter;
+               __entry->state = state;
+       ),
+
+       TP_printk("counter=%lu, state=%lu",
+                 (unsigned long)__entry->counter,
+                 (unsigned long)__entry->state)
+);
+
 DEFINE_EVENT(cpu, cpu_frequency,
 
        TP_PROTO(unsigned int frequency, unsigned int cpu_id),