This tutorial describes how to use Streamline to capture a profile of a debuggable application running on an unrooted Android target with a MaliTM GPU.
Follow the steps in each section to set up your environment, connect to the target device and capture a profile to analyze.
Choose Next to browse through the steps as you work through them, or choose Single Page to view all the steps on one page.
Before you begin
On your host machine:
- Download and install the Arm Mobile Studio package appropriate to your host platform (Windows, Linux, or macOS).
- Install Python 3.5 (or higher). You will need this to run the provided
gator_me.pyscript, which uses the
gatordagent to connect Streamline to your Android target.
- Install Android Debug Bridge (ADB). ADB is available with the Android SDK platform tools, which are installed as part of Android Studio, or you can download them separately here.
- Edit your
PATHenvironment variable to add the paths to the Python3 directory and the Android SDK platform tools directory.
Configure your device
On your device:
- Ensure Developer Mode is enabled, then enable USB Debugging using Settings > Developer options.
- Connect the target to the host through USB.
- Run the
adb devicescommand on the host to check that connection is successful. If successful, this command returns the ID of your target.
adb devices List of devices attached ce12345abcdf1a1234 deviceYou should also be able to run
adb shellwithout issues.
- Install a debuggable application:
- For Unity applications, select the Development Build option in Unity's Build Settings when building your application.
- If you're not using Unity, ensure your application is marked as debuggable in the Android application manifest (see more on how to do this in the Android Studio documentation).
Connect Streamline to your device
Arm provides a Python script,
gator_me.py that installs a daemon,
gatord, on your device. Streamline uses this daemon to connect to unrooted Android devices and collect data. Follow these steps to run the script so that Streamline can communicate with your device.
- On your host machine, navigate to the Streamline installation directory,
<install_dir>/streamline/gator/where you will find the
- Run the
gator_me.pyscript with the
--daemonoption, to supply the path to the
gatordbinary that will be installed on the device. For example:
python3 gator_me.py --daemon <install_dir>/streamline/bin/arm64/gatord
There are two versions of the
gatord, for 32-bit or 64-bit architectures, located in the following directories:
<install_dir>/streamline/bin/arm64/for Armv8 64-bit architectures.
<install_dir>/streamline/bin/arm/for 32-bit architectures.
- The script will return a numbered list of the Android package names for the debuggable applications that are installed on your device. Enter the number of the package you want to profile.
gator_me.pyscript does the following:
- Kills and removes
gatordand removes any counter configuration file that was previously created.
- Enables perf profiling.
gatordto the target.
gatordinside the Android application sandbox.
- Configures port forwarding.
- Waits for you to configure and perform the capture in Streamline.
- When the capture is complete, it kills and removes
Alternatively, if you know the Android package name of the app you want to profile you can specify it when running the script, using the
python3 gator_me.py --package com.mycompany.myapp --daemon <install_dir>/streamline/bin/arm64/gatord
- Kills and removes
- Launch Streamline:
- On Windows, from the Start menu, navigate to the Arm Mobile Studio folder, and select the Streamline shortcut.
- On macOS, go to the
<install_dir>/streamlinefolder, and double-click the
- On Linux, go to the
<install_dir>/streamlinefolder, and run the
- Choose the Target tab, and enter localhost:8080 in the target name field. This value is the local TCP port that is specified in the
Choose a counter template
Counter templates are pre-defined sets of counters that have been chosen to enable you to perform an initial performance review of both CPU and GPU behavior. Choose the most appropriate template for the GPU in your target device.
- From the Target tab, open the Counter Configuration dialog by selecting the button.
- Choose Add counters from a template to see the list of available templates.
- Choose a counter template appropriate for the target GPU in your target device. The number of counters in the template that your target device supports is shown next to each template. For example, here, 34 of the 38 available counters in the Mali Midgard template are supported in the connected device.
- Save your changes.
- Optionally, select the Capture & analysis options button from the Target tab, to set additional capture options, including the sample rate and the capture duration. Refer to Capture options in the Arm Streamline User Guide for more details.
Capture a profile
- In Streamline, select the Start Capture button to start capturing data from the target device. Specify the name and location on the host of the capture file that Streamline will create when the capture is complete. Streamline then switches to Live view and waits for you to start the application on the device.
- Start the application you want to profile. Live view shows charts for each counter that you selected. Below the charts is a list of running processes in your application with their CPU usage. The charts now start updating in real time to show the data that
gatordcaptures from your running application:
- Unless you specified a capture duration, click Stop capture to end the capture . Arm Streamline stores the capture file in the location you specified previously and then prepares the capture for analysis. When complete, the capture appears in the Timeline view.
- IMPORTANT: Switch back to the terminal running the
script and press any key to terminate it. The script kills all processes that it started and removes
gatordfrom the target.
- Select the Switch and manage templates button and select the same counter configuration template that you chose to create the capture.
Analyze your capture
Analyze the data in Streamline's Timeline view. The charts area is populated with the hardware counter activity for the counters you selected during the capture. Below the charts area is the details panel, which provides further metrics from your capture. Both the charts and details panel are aligned on the timeline.
- Control the granularity of the data by selecting the time unit. For example, if you choose 50ms, every color-coded unit in the details panel represents data captured during a 50ms window.
- Hover over a chart to see the values at that point on the timeline.
- Click anywhere on the timeline and drag the handles on the cross-section marker to select a range of time to investigate more closely. The information shown in the details panel when in Processes and Samples modes updates to show data for the window of time you have defined.
Note: If you define a region of time with the Cross-section marker, then change the view to a larger time unit where the Cross-section marker border cannot sit precisely, the border is displayed as a blurred line.
- Unlike the filter controls, moving and expanding the Cross-section marker does not affect the data in the other report views. To do this, use the calipers to set the required time region. Drag the calipers to the required time region, or right-click on the timeline and select Set Left Caliper or Set Right Caliper. When you move the calipers, the Call Paths, Functions, and Code views update to show information for the selected region.
For more information about how to analyze performance with Arm Streamline, see Analyze your capture in the Arm Streamline User Guide.
Disconnect Streamline from your target
- IMPORTANT: On the host, switch back to the terminal running the
script and press any key to terminate the script. The script kills all processes that it started and removes
gatordfrom the target.
- Unplug your device from your host machine.