Concurrent Power and Performance Analysis on Android

By Promotion Published Date
13 - May - 2016
| Last Updated
13 - May - 2016
Concurrent Power and Performance Analysis on Android

Concurrent Power and Performance Analysis on Android using Intel® VTune™ Amplifier and Intel® SoC Watch.

With some of the new features available in Intel® VTune™ Amplifier 2016 Update 1 it is now relatively easy to obtain simultaneous capture of power and performance data on an unplugged Android device. 

Note: Although it's possible to connect with "ADB over WiFi" and thus skip the need for using the "Analyze unplugged device" option it has generally been considered easier to connect to the target device with a USB cable making this a relatively easy solution.  Should you instead wish to use "ADB over WiFi" instructions for setting that up are included in your Intel® VTune™ Amplifier product documentation. 

Step 1: Preparing Performance Analysis

When using the GUI simply select the "Analyze unplugged device" option in the Analysis Target tab of project properties under the Advanced options.  It is recommended to also select "Automatically stop collection after (sec):" and specify a collection time, this way it's simple enough to specify the same length of time for power analysis collection.

Then select your Analysis Type and run analysis as normal.  Go ahead and select all options as normal, but pause just before selecting "Start" in order to prepare the Power analysis collector to run concurrently.

Step 2: Preparing Power Analysis

Using an independent command line ADB shell into the device and prepare for collecting a power analysis data.  If you are unfamiliar with the steps a walk-through guide is located here.

Before starting the actual collector make sure that your command line uses the "nohup" and run in background "&" options.  Then pause before actually hitting enter to execute and we'll sync up both collectors to run concurrently. Here is an example Intel SoC Watch collection command-line from version 1.5.4.  If using Intel SoC Watch version 2.0 or newer (such as 2.1.1) then don't forget to use "-r vtune" in order to get appropriate post-processing for import into Intel® VTune™ Amplifier.  

nohup ./socwatch -m -f sys -f wakelock -t 35 -o ./results/concurr_t

Note: The & at the end of the command is a standard linux/unix option to run the command as a background task.  Use of the "nohup" at the beginning tells the system not to tie the background task to the existing terminal, in other words once the terminal is closed (adb connection lost when you remove the cable) continue to let the command run rather than terminating.
Step 3: Synchronizing the collector start times

At this point go back to the Intel® VTune™ Amplifier window and select "Start".  There will be the usual set of messages flashed on the device, then some new ones related to running in "unplugged" mode, and eventually you will get the message "Unplug the device please.  Collection will start automatically."

At this point return to the Intel SoC Watch collection terminal and hit enter, then disconnect the USB cable from the device.

Run your workload of interest as normal.  Note: Without the cable connected Amplifier will not automatically stop the application after the collection time has completed, once you are certain the collection period has completed then re-connect the cable.

Step 4: Reviewing the results

Once collection has stopped and the cable is re-connected then performance data will be pulled, and finalized automatically just as if run on a continually connected device.

After the results have been finalized and displayed in Intel® VTune™ Amplifier then return to the Intel SoC Watch terminal and pull the Intel SoC Watch results over.  They may then be imported into Intel® VTune™ Amplifier as normal.

For more such Android resources and tools from Intel, please visit the Intel® Developer Zone