Perf on Android

We are working on project that requires us to collect performance events on Android. This involves a few steps:

  • Recompile the kernel with the right flags. You should do this incrementally, some options may make you kernel crash at boot time. You should consider including the following flags
    • CONFIG_FUNCTION_TRACER=y
    • CONFIG_FUNCTION_GRAPH_TRACER=y
    • CONFIG_DYNAMIC_FTRACE=y
    • CONFIG_STACK_TRACER=y
    • CONFIG_SCHED_TRACER=y
    • CONFIG_BLK_DEV_IO_TRACE=y
  • Compile the perf tool. It is nicely part of the Android source and you can just compile it easily with the rest of the distribution.
  • To get started with perf, you can take a look at the following one-liner examples: http://www.brendangregg.com/perf.html

Interesting power management information is spread in multiple place. Below, I will summarize some of it (as I learn it):

  • CPU:
    • The time spent in different states can be directly obtained from cpufreq-stats. Similar statistics can be obtained from when the system is idle, from cupidle.
Advertisements
Tagged with:
Posted in Android

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories
%d bloggers like this: