Intel® VTune™ Amplifier

Collecting Data on Android* Systems from Command Line

Note

Remote analysis on Android* systems is supported by the Intel® VTune™ Amplifier for Systems, part of the Intel® System Studio.

Intel® VTune™ Amplifier enables you to collect data on a remote Android application from the host system (remote usage mode) via command line interface (amplxe-cl) and view the analysis result locally in the GUI. You may run the following analysis types on Android:

Configuring and Running a Performance Analysis on Android

Remote data collection using the amplxe-cl command running on the host is very similar to the native collection on the target except that the -target-system option is added to the command line.

Prerequisites: Make sure to prepare your Android system and your target application for analysis.

To run an analysis on an Android device:

  1. Launch your application on the target device.

  2. Find out <pid> or <name> of the application. For example, you can use adb shell ps command for the purpose:

    $ adb shell ps
    ...
    root 2702 2 0 0 c1263c67 00000000 S kworker/0:2
    root 2953 2 0 0 c1263c67 00000000 S kworker/3:2
    root 2956 2 0 0 c1263c67 00000000 S kworker/u:3
    u0_a76 2961 129 536988 68788 ffffffff 400725cf S com.intel.fluid
    
    root 3040 2 0 0 c1263c67 00000000 S kworker/1:2
    root 3043 2 0 0 c1291fa5 00000000 S watchdog/0
    root 3044 2 0 0 c1291fa5 00000000 S watchdog/1
    ... 
  3. Optional: If you have several Android devices, you may set the ANDROID_SERIAL environment variable to specify the device you plan to use for analysis. For example:

    export ANDROID_SERIAL= emulator-5554 or export ANDROID_SERIAL= 10.23.235.47:5555

  4. On the development host, run amplxe-cl to collect data.

    By default, the amplxe-cl utility is located in the <install_dir>/bin{32,64} directory.

    To run an analysis, enter:

    host>./amplxe-cl --collect <analysis_type> --target-system=android:deviceName -r <result_name> --target-process <process_name> --search-dir=<search_dir> --source-search-dir=<source_search_dir>

    where:

    • <analysis_type> is a predefined analysis type, such as hotspots, advanced-hotspots, general-exploration, and so on.

      Note

      Use --collect option to launch predefined analysis types. To launch a custom analysis with your own settings, use the --collect-with option.

    • deviceName is the name of your Android device, for example: Medfield2B3E703C . If you do not specify the name of the device, the VTune Amplifier uses the default device specified with adb. You do not need to specify the device name if you set the ANDROID_SERIAL environment variable before the collection.

    • <result_name> is a PATH/name of the directory where a result is stored

    • <process_name> is PID or name of the Android application

    • <search_dir> is a path to search for binary files used by your Android application

    • <source_search_dir> is a path to search for source files used by your Android application

    Note: You may have the VTune Amplifier for Systems GUI automatically generate the command line configuration for you by clicking the Command Line… button in the Analysis Type window. Copy and paste this command line to the shell, add the --target-system=android option, specify the target process (if required) and launch the analysis. If you use the Command Line… button to generate a command line for a custom event-based analysis, make sure to update the event list in the command line before running it from the shell. By default, the VTune Amplifier GUI provides an event list for the processor used by the host system. To run a custom event-based analysis on Android, you need to replace this event list with events used by the processor with the Android target. See the Generating Command Line Configuration from GUI topic in the VTune Amplifier Help for more details.

  5. Stop collection by pressing Ctrl-C or sending the stop command from another console on the host development system:

    host>./amplxe-cl -r <result_name> -C stop

    • An additional way to stop the collection is to specify the duration in seconds during collection, for example:

      host>./amplxe-cl --collect advanced-hotspots --target-system=android -d 50 -r system_wide_r@@@  
      		

      or

      host>./amplxe-cl --collect advanced-hotspots --knob collection-detail=stack-sampling 
      		  -d 50 -r quadrant_r@@@ --target-system=android --target-process com.intel.fluid

    • You can send pause and resume commands during collection, for example:

       host>.amplxe-cl -C pause -r quadrant_r@@@ 
      	 

       host>./amplxe-cl -C resume -r quadrant_r@@@

Running User-mode Sampling and Tracing (Basic Hotspots) Analysis

In this mode, you can:

Example:

host>./amplxe-cl --collect hotspots --target-system=android -r quadrant_r@@@ --target-process com.intel.fluid 
		

In this mode you cannot:

Running Event-Based Sampling Analysis

In this mode, you can:

In this mode, you cannot:

A list of EBS analysis types supported by the VTune Amplifier for Systems on Android depends on the processor used by your Android device:

Analysis Type

Command Line Name

Intel® Atom™ processors

Advanced Hotspots

advanced-hotspots

General Exploration

general-exploration

4th Generation Intel® Core™ processors (based on Intel microarchitecture code name Haswell)

Advanced Hotspots

advanced-hotspots

General Exploration

general-exploration

Memory Access

memory-access

For example, to collect a complete list of events required to analyze typical client applications running on the 4th Generation Intel Core processor, enter:

host>./amplxe-cl --collect general-exploration --target-system=android -r quadrant_r@@@ --target-process com.intel.fluid

By default, the VTune Amplifier does not collect stack data during hardware event-based sampling. To enable call stack analysis, use the collection-detail=stack-sampling knob. For example:

host>./amplxe-cl --collect advanced-hotspots --knob collection-detail=stack-sampling --target-system=android -r quadrant_r@@@ --target-process com.intel.fluid

To analyze performance of your target application and all other processes running on the Android system, use the --duration option and do not specify an analysis target. For example:

host>./amplxe-cl --collect advanced-hotspots --target-system=android -duration=60 -r system_wide_r@@@

To associate JITed Java functions to samples in the system-wide event-based sampling, you have the following two options:

Running GPU Analysis

You can enable GPU usage analysis for algorithm analysis types on systems with Intel HD Graphics by using the following knobs:

For example, to run the Basic Hotspots analysis and monitor GPU usage, enter:

host>./amplxe-cl --collect hotspots --target-system=android -r quadrant_r@@@ --target-process com.intel.fluid --knob enable-gpu-usage=true --knob gpu-counters-mode=overview
		

Note

Running Custom Analysis

Use the --collect-with option to configure the VTune Amplifier to run a custom user-mode sampling and tracing (runss) or event-based sampling (runsa) analysis and take other than default configuration options. For example, to run a custom event-based sampling analysis, use the --collect-with option and specify required counters with the -knob event-config option as follows:

 host>./amplxe-cl --collect-with runsa --target-process com.intel.fluid -r system_wide_r@@@ --knob collection-detail=stack-sampling [--event-mux] --event-config COUNTER1[:sa=#],COUNTER2[:sa=#],COUNTER3[:sa=#]

You can take any counter that the Performance Monitoring Unit (PMU) of that processor supports. Additionally, you can enable multiple counters at a time. Each processor supports only a specific number of counters that can be taken at a time. You can take more events than the processor supports by using the --event-mux option, which will round robin the events you specified on the available counters in that processor.

Note

Typically, you are recommended to use analysis types with the predefined sets of counters. Use of specific counters is targeted for advanced users. Please note that names of some counters may not exactly correspond to the analysis scope provided with these counters.

After collecting these counters, import the results into a project of the VTune Amplifier for Systems and explore the General Exploration viewpoint data.

Running Intel Energy Profiler Analysis

For Intel Energy Profiler analysis, you need to launch the data collection directly on your Android system using the Intel SoC Watch command line tools available with the remote target package. See details in the Intel SoC Watch User Guide provided with the collector.

See Also