Intel® VTune™ Amplifier XE and Intel® VTune™ Amplifier for Systems Help
Remote analysis on Android* systems is supported in the Intel® VTune™ Amplifier for Systems, part of the Intel® System Studio.
When using the VTune Amplifier to collect data remotely on a target Android device, make sure to:
For hardware event-based sampling or energy analysis, gain a root mode adb access to the Android device.
Optionally, do the following:
To view functions within Android-supplied system libraries, device drivers, or the kernel, get access from the host development system to the exact version of these binaries with symbols not stripped.
To view sources within Android-supplied system libraries, device drivers, or the kernel, get access from the host development system to the sources for these components.
To configure your Android device, do the following:
Allow Debug connections to enable adb access:
Select Settings > About <device>.
Tap Build number seven times to enable the Developer Options tab.
Select the Settings > Developer Options and enable the USB debugging option.
Path to the Developer Options may vary depending on the manufacture of your device and system version.
Enable Unknown Sources to install the VTune Amplifier Android package without Google* Play. To do this, select Settings > Security and enable the Unknown Sources option.
VTune Amplifier collector for Android requires connectivity to the Android device via adb. Typically Android devices are connected to the host via USB. If it is difficult or impossible to get adb access to a device over USB, you may get adb over Ethernet or WiFi. To connect ADB over Ethernet or WiFi, first connect to Ethernet or connect to a WiFi access point and then do the following:
Find the IP Address of the target. The IP address is available in Android for Ethernet via Settings>Wireless&Networks>Ethernet>IP Address or for Wi-Fi via Settings>Wireless&Networks>Wi-Fi><Connected Access Point>>IP Address.
Make sure adb is enabled on the target device. If not enabled, go to Terminal App (of your choice) on the device and type:
$ su
$ setprop service.adb.tcp.port 5555
$ stop adbd
$ start adbd
Connect adb on the host to the remote device. In the Command Prompt or the Terminal on the host, type:
$ adb connect <IPAddres>:5555
For performance and Energy analysis on Android platforms, you typically need a root mode adb access to your device to:
Install and load drivers needed for hardware event-based sampling and energy analysis with Intel SoC Watch.
Enable the Android device to support Java* analysis.
Run hardware event-based sampling analysis and energy analysis.
There are several analysis types on Android systems that do NOT require root privileges such as Basic Hotspots Analysis and Perf*-based Driverless Event-Based Sampling Collection.
Depending on the build, you gain root mode adb access differently:
User/Production builds : Gaining root mode adb access to a user build of the Android OS is difficult and different for various devices. Contact your manufacturer for how to do this.
Engineering builds : Root-mode adb access is the default for engineering builds. Engineering builds of the Android OS are by their nature not "optimized". Using the VTune Amplifier against an engineering build is likely to result in VTune Amplifier identifying code to optimize which is already optimized in user and userdebug builds.
Userdebug builds : Userdebug builds of the Android OS offer a compromise between good results and easy-to-run tools. By default, userdebug builds run adb in user mode. VTune Amplifier tools require root mode access to the device, which you can gain via typing adb root on the host. These instructions are based on userdebug builds.
For hardware event-based sampling analysis and energy analysis, the VTune Amplifier needs sampling and power drivers to be installed. On some versions of Android systems, including most of the Intel supplied reference builds for SDVs, the following drivers are pre-installed in /lib/modules or /system/lib/modules :
Energy analysis collector: SOCWATCH2_x.ko applied to the Intel 22 nm ultra-mobile processor and 4th Generation Intel® Core™ processors
Hardware event-based analysis collectors:
socperf2_0.ko
pax.ko
sep3_x.ko
vtsspp.ko
Typically having pre-installed drivers is more convenient. You can check for pre-installed drivers by typing:
adb shell ls [/lib/modules|/system/lib/modules]
If the drivers are not available or the version does not match requirements, consider:
Enabling Java Analysis on Rooted Devices
By default, the VTune Amplifier installs the remote collector on the target rooted Android devices with the --jitvtuneinfo=src option. To change the Java profiling option for rooted devices, you need to re-install the remote collector on the target manually using the --jitvtuneinfo=[jit|src|dex|none] option on amplxe-androidreg.sh. For example:
<Introducing the Intel VTune Amplifier >/bin{32,64}/amplxe-androidreg.sh --package-command=install --jitvtuneinfo=src
VTune Amplifier updates the /data/local.prop file as follows:
Basic information about the compiled trace: root@android:/ # cat /data/local.prop dalvik.vm.extra-opts=-Xjitvtuneinfo:jit
Mapping from JIT code to Java source code and basic information about the compiled trace: root@android:/ # cat /data/local.prop dalvik.vm.extra-opts=-Xjitvtuneinfo:src
Mapping from JIT code to DEX code and basic information about the compiled trace: root@android:/ # cat /data/local.prop dalvik.vm.extra-opts=-Xjitvtuneinfo:dex
JIT data collection. By default, JIT collection is disabled if you do not supply any options: root@android:/ # cat /data/local.prop dalvik.vm.extra-opts=-Xjitvtuneinfo:none
Additionally, if your Dalvik JVM supports instruction scheduling, disable it by adding -Xnoscheduling at the end of dalvik.vm.extra-opts. For example:
root@android:/ # cat /data/local.prop dalvik.vm.extra-opts=-Xjitvtuneinfo:src -Xnoscheduling
Java analysis currently requires an instrumented Dalvik JVM. Android systems running on the 4th Generation Intel® Core™ processors or Android systems using ART vs. Dalvik for Java are not instrumented to support JIT profiling. You do not need to specify --jitvtuneinfo=N.
Enabling Java Analysis for Code Generated with ART* Compiler
To enable a source-level analysis, the VTune Amplifier requires debug information for the analyzed binary files. By default, the ART compiler does not generate the debug information for Java code. Depending on your usage scenario, you may choose how to enable generating the debug information with the ART compiler:
For releases prior to Android 6.0 Marshmallow*, the --generate-debug-info in the examples below should be replaced with --include-debug-symbols.
To Do This: |
Do This: |
---|---|
Profile a 3rd party application or system application installed as an .apk file |
|
Profile all applications installed as .apk or .jar files by re-building the Android image when pre-optimization for private applications is enabled (LOCAL_DEX_PREOPT:=true property set in device.mk) |
|
Profile all applications installed as .apk or .jar files by re-building the Android image when pre-optimization for private applications is disabled (LOCAL_DEX_PREOPT:=false property set in device.mk) |
|
Profile an application executed by the dalvikvm executable |
Add the compiler option --generate-debug-info followed by -Xcompiler-option. Make sure the application has not been compiled yet.
|
Profile system and core classes NoteThis action is required if Java core classes get compiled to the /data/dalvik-cache/ subdirectory. Manufacturers may place them in different directories. If manufactures supply the precompiled boot.oat file in /system/framework/x86, Java core classes will not be resolved because they cannot be re-compiled with debug information. |
Set the system property dalvik.vm.image-dex2oat-flags to --generate-debug-info and force recompilation:
If you run the application before the system classes are compiled, you should add another compiler option -Ximage-compiler-option --generate-debug-info:
|
If you are able to see the --generate-debug-info option in the logcat output (adb logcat *:S dex2oat:I), the compiler uses this option.