A prior article, called Automated Android* Application Testing, explains automated testing and gives several methods for how to implement automated functional testing. But functional testing is not the only QA task that you can automate.
It's useful to collect and analyze metrics such as CPU usage, memory usage, FPS, and so on. It's particularly important to collect and analyze such metrics on a regular basis to detect performance regressions. If you analyze performance regularly, then it will be easier to find the code that caused performance regression. That's why it makes sense to automate the analysis process. In this article I'll review the Intel® Graphics Performance Analyzers (Intel® GPA) Console Client, a tool that can help to automate performance analysis.
The Intel GPA System Analyzer is a tool to analyze Android applications manually. It's a very useful tool to collect multiple metrics in real time. The main focus is on graphics applications, but the tool can be used to analyze any application. A good overview of the Intel GPA System Analyzer is given in the article Intel® Graphics Performance Analyzers 2013 for Android* OS Getting Started Guide.
With the Intel GPA Console Client you can automate many functions and features of the Intel GPA System Analyzer, so being familiar with it is helpful. Supported devices are listed in the Intel GPA documentation.
Intel GPA Console Client is a part of Intel GPA. The latest version is available here: http://software.intel.com/en-us/vcsource/tools/intel-gpa
Abstract automation example
Let's say you've developed a game engine. The demo application is created and it doesn't require user actions during run time.
This demo application is rebuilt and analyzed with every game engine version. Graphics and system metrics are collected and stored in a CSV file using Intel GPA Console Client.
Intel GPA Console Client automatically processes the results and compares them to previously collected results. This allows automatically detecting regressions in the game engine. This approach is applicable to almost any program, not just games.
Preparing the Android application for analysis
To prepare the application for analysis using the Intel GPA Console Client:
- Open the
- Add the Internet permission:
- Set the
- Rebuild and install the apk file to the device.
Using the Intel GPA Console Client
The Windows* binary is named
gpa_console_client.exe, but the Linux* binary is named
Select Android device
gpa_console_client -dn "Device Name" [options]
You can use the
adb devices command to obtain the device name. If only one device is connected, then this parameter can be skipped.
Fetch the applications list
To fetch the list of all installed applications, use the command:
The tool will display a list containing the application name, package name, and activity name.
Start the application «App Name» and collect all available metrics:
gpa_console_client -an "App Name"
A complication may be that the set of available metrics may change during the application run time. For example, graphic metrics could activate. In this case, the CSV file will contain several tables with several headers. The new table header is generated every time the set of available metrics change.
Select the metrics to collect
To collect a uniform table of results in the CSV file, you should explicitly specify the list of metrics.
To get a list of all available metrics, use the command:
Select the relevant metrics and save them to file.cfg.
Start the application with the specified metrics:
gpa_console_client -cfg file.cfg -an "App Name"
In this case, you will get a table with metrics listed in the configuration file. If several metrics are not available, then the corresponding cells will be empty.
Set delay and collection time
You can delay the metrics collection after the application starts:
gpa_console_client -cd [delay] [options]
You can set a metrics collection time:
gpa_console_client -ct [time] [options]
After that, the application will be closed.
The tool will search for ADB binary in the directories listed in the PATH environment variable.
You can explicitly specify a path to ADB binary (including the binary name!) in the –adb param.
gpa_console_client -adb "/home/user/android/platform-tools/adb" [options]
Running the Intel GPA Console Client
Now let's use the Intel GPA Console Client to collect metrics from the BasicGLSurfaceView. BasicGLSurfaceView is a sample application included in the Android SDK.
- Open the project BasicGLSurfaceView (Android_SDK/samples/android-*/BasicGLSurfaceView).
- Prepare the application for analysis by editing AndroidManifest.xml, rebuild the apk file, and install it on the device:
adb install BasicGLSurfaceViewActivity.apk
- Fetch the list of all installed applications:
- Start the application and collect all available metrics to metrics.csv:
gpa-console-client -an "Basic GLSurfaceView" –csv metrics.csv
The Intel GPA Console Client will start the application and store all available metrics in metrics.csv.
- Prepare the config file with the relevant metrics list.
Fetch all available metrics:
Create the config file metrics.cfg:
metric.cpu.processor_time # Aggregated CPU Load metric.cpu.targetapp.memory.resident # App Resident Memory metric.gl.frame_rate # FPS
- Start the application and collect metrics from the config file:
gpa-console-client -an "Basic GLSurfaceView" -cfg metrics.cfg –csv metrics.csv
The Intel GPA Console Client will start the application, collect the specified metrics, and store them in metrics.csv.
- Collect the metrics for 15 seconds with a 10-seconds startup delay:
gpa-console-client -an "Basic GLSurfaceView" -cfg metrics.cfg -cd 10 -ct 15 –csv metrics.csv
In this article I've reviewed the Intel GPA Console Client tool that can collect metrics during the application run time in non-interactive mode. This tool can be useful to automate the performance analysis of Android applications.
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR.
Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information.
The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.
Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.
Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or go to: http://www.intel.com/design/literature.htm
Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such as SYSmark* and MobileMark*, are measured using specific computer systems, components, software, operations, and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products.
Any software source code reprinted in this document is furnished under a software license and may only be used or copied in accordance with the terms of that license.
Intel and the Intel logo are trademarks of Intel Corporation in the US and/or other countries.
Copyright © 2013 Intel Corporation. All rights reserved.
*Other names and brands may be claimed as the property of others.