Analyzing Android UI Performance

Integrating UI Performance into your testing practices guarantees interaction with your applications satisfies users’ demands.

An important step in app testing is measuring UI performance, but it is sometimes eclipsed by testing application functionality. Once you are done with functional tests, you may want to ensure that user interactions with your app are smooth, and they run at a consistent 60 frames per second mark. Not delaying or dropping frames, which is very noticeable and have a great impact on the perceived quality of your app.

The official page Testing UI Performance shows how to measure UI performance and how to obtain precise frame timing info using adb shell dumpsys command. However, it is very tedious to do all the steps manually and finally get extremely raw data presented as a series of frame timings. You should parse the raw output to locate the timings, then extract them and finally, copy and paste into a spreadsheet or some other software with the ability to create charts.


Wouldn’t it be great if you can just run a command a obtain the chart without all the tedious work?

AndroidViewClient/culebra, which its main purpose is to automate Android testing, can also help in this case simplifying the steps that usually require manual interaction. In such way, you can measure UI performance, and produce charts that will help you understand and locate the problems.

Latest AndroidViewClient/culebra versions have introduced the ability to plot some metrics from your device or emulator directly. The Dumpsys module obtains and parses dumpsys information to greatly facilitate its usage converting it to objects.

The following python script shows how we can use it to obtain FRAMESTATS from dumpsys output.

Firstly, it opens the connection to the device that should already be present when you run adb devices. If the connection fails the script will exit with an error message.

Then, the Dumpsys object is obtained, stating that we are interested in FRAMESTATS for the pkg package that is specified in the command line. This object is appended to the Plot and later the plot obtained.

Before you could obtain this data from the device you should enable it in Developer options

After this, you should start playing with your app so the relevant timing data is collected. We will cover this in future articles but automating this step is also a great candidate for AndroidViewClient/culebra or CulebraTester.

For example, using the sample performance testing app with package, when we run


we obtain a histogram plot similar to this one.

The cyan and red vertical lines indicate 60fps and 30fps respectively. You can easily verify, in this case, that most of the frames are under the 60fps mark, indicating a fluid UI.

Enjoy it!