summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2012-05-07 17:58:44 -0700
committerJamie Gennis <jgennis@google.com>2012-05-07 17:58:44 -0700
commit3169533f1d11c4a7aa0cd6fa2aa04fc810db0de6 (patch)
treedac7ed391ccdafebab551a15c9995e848213a87c
parent7b5170b249c1d312cfe3b5658b6c140b2a48226f (diff)
downloadframeworks_native-3169533f1d11c4a7aa0cd6fa2aa04fc810db0de6.zip
frameworks_native-3169533f1d11c4a7aa0cd6fa2aa04fc810db0de6.tar.gz
frameworks_native-3169533f1d11c4a7aa0cd6fa2aa04fc810db0de6.tar.bz2
atrace: add support for tracing CPU idle events
This change adds the -i command line flag to atrace to enable tracing CPU idle kernel events. Change-Id: I4a2c8619224c0f50c7fd7c61c7b24fa2211f656c
-rw-r--r--cmds/atrace/atrace.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/cmds/atrace/atrace.c b/cmds/atrace/atrace.c
index 7b4f55e..a674295 100644
--- a/cmds/atrace/atrace.c
+++ b/cmds/atrace/atrace.c
@@ -29,6 +29,7 @@
static int g_traceDurationSeconds = 5;
static bool g_traceSchedSwitch = false;
static bool g_traceCpuFrequency = false;
+static bool g_traceCpuIdle = false;
static bool g_traceGovernorLoad = false;
static bool g_traceWorkqueue = false;
static bool g_traceOverwrite = false;
@@ -54,6 +55,9 @@ static const char* k_schedSwitchEnablePath =
static const char* k_cpuFreqEnablePath =
"/sys/kernel/debug/tracing/events/power/cpu_frequency/enable";
+static const char* k_cpuIdleEnablePath =
+ "/sys/kernel/debug/tracing/events/power/cpu_idle/enable";
+
static const char* k_governorLoadEnablePath =
"/sys/kernel/debug/tracing/events/cpufreq_interactive/enable";
@@ -117,6 +121,12 @@ static bool setCpuFrequencyTracingEnable(bool enable)
return setKernelOptionEnable(k_cpuFreqEnablePath, enable);
}
+// Enable or disable tracing of CPU idle events.
+static bool setCpuIdleTracingEnable(bool enable)
+{
+ return setKernelOptionEnable(k_cpuIdleEnablePath, enable);
+}
+
// Enable or disable tracing of the interactive CPU frequency governor's idea of
// the CPU load.
static bool setGovernorLoadTracingEnable(bool enable)
@@ -184,6 +194,7 @@ static bool startTrace()
ok &= setTraceOverwriteEnable(g_traceOverwrite);
ok &= setSchedSwitchTracingEnable(g_traceSchedSwitch);
ok &= setCpuFrequencyTracingEnable(g_traceCpuFrequency);
+ ok &= setCpuIdleTracingEnable(g_traceCpuIdle);
if (fileExists(k_governorLoadEnablePath) || g_traceGovernorLoad) {
ok &= setGovernorLoadTracingEnable(g_traceGovernorLoad);
}
@@ -363,7 +374,7 @@ int main(int argc, char **argv)
for (;;) {
int ret;
- ret = getopt(argc, argv, "b:cflst:wz");
+ ret = getopt(argc, argv, "b:ciflst:wz");
if (ret < 0) {
break;
@@ -378,6 +389,10 @@ int main(int argc, char **argv)
g_traceOverwrite = true;
break;
+ case 'i':
+ g_traceCpuIdle = true;
+ break;
+
case 'l':
g_traceGovernorLoad = true;
break;