インテル® VTune™ Amplifier 2018 ヘルプ

Android* System Setup

When using the VTune Amplifier to collect data remotely on a target Android device, make sure to:

Optionally, do the following:

Configuring an Android Device for Analysis

To configure your Android device, do the following:

  1. Allow Debug connections to enable adb access:

    1. Select Settings > About <device>.

    2. Tap Build number seven times to enable the Developer Options tab.

    3. Select the Settings > Developer Options and enable the USB debugging option.

    Note

    Path to the Developer Options may vary depending on the manufacture of your device and system version.

  2. 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.

Gaining ADB Access to an Android Device

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:

  1. 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.

  2. 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
  3. Connect adb on the host to the remote device. In the Command Prompt or the Terminal on the host, type:

    > adb connect <IPAddres>:5555

Gaining a Root Mode ADB Access to the Android Device

For performance analysis on Android platforms, you typically need a root mode adb access to your device to:

Note

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:

Using the Pre-installed Drivers on the Target Android System

For hardware event-based sampling analysis, the VTune Amplifier needs sampling 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 :

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 building and installing the drivers.

Enabling Java* Analysis

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.bat (Windows) or amplxe-androidreg.sh (Linux). For example:

On Windows*:

<install-dir >/bin32/amplxe-androidreg.bat --package-command=install --jitvtuneinfo=src

On Linux*:

<install-dir >/bin{32,64}/amplxe-androidreg.sh --package-command=install --jitvtuneinfo=src

VTune Amplifier updates the /data/local.prop file as follows:

  1. Basic information about the compiled trace: root@android:/ # cat /data/local.prop dalvik.vm.extra-opts=-Xjitvtuneinfo:jit

  2. 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

  3. 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

  4. 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

Note

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:

Note

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

  1. Set the system property dalvik.vm.dex2oat-flags to --generate-debug-info:

    adb shell setprop dalvik.vm.dex2oat-flags --generate-debug-info

  2. If you use --compiler-filter=interpret-only, set the optimization level to speed:

    adb shell setprop
    dalvik.vm.dex2oat-filter speed

  3. (Re-)install the application.

    adb shell install -r
    TheApp.apk

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)

  1. On your host system, open the /build/core/dex_preopt_libart.mk file, located in your Android OS directory structure.

  2. Modify the --no-generate-debug-info line to --generate-debug-info and save and close the file.

  3. Rebuild the Android image and flash it to your device.

  4. If you are using an Android image that is not PIC configured (WITH_DEXPREOPT_PIC:=false property set in device.mk), generate classes.dex from odex using the patchoat command. classes.dex should appear in /data/dalvik-cache/x86/system@app@appname@appname.apk@classes.dex

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)

  1. Set the system property dalvik.vm.dex2oat-flags to --generate-debug-info:

    adb shell rm -rf /data/dalvik-cache/x86/system@app@webview@webview.apk@classes.dex
    adb shell setprop dalvik.vm.dex2oat-flags --generate-debug-info
  2. Stop and start the adb shell:

    adb shell stop
    adb shell start
  3. Generate the dex file:

    adb shell ls /data/dalvik-cache/x86/system@app@webview@webview.apk@classes.dex
    adb pull /data/dalvik-cache/x86/system@app@webview@webview.apk@classes.dex

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.

rm –f /data/dalvik-cache/*/*TheApp.jar*
adb shell dalvikvm –Xcompiler-option --include-debug-symbols –cp TheApp.jar

Profile system and core classes

Note

This 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:

adb shell stop
adb shell rm –f /data/dalvik-cache/*/*
adb shell setprop dalvik.vm.dex2oat-flags --generate-debug-info
adb shell setprop dalvik.vm.image-dex2oat-flags --generate-debug-info
adb shell start

If you run the application before the system classes are compiled, you should add another compiler option -Ximage-compiler-option --generate-debug-info:

adb shell rm –f /data/dalvik-cache/*/*
adb shell dalvikvm –Xcompiler-option --generate-debug-info -Ximage-compiler-option --generate-debug-info –cp TheApp.jar

Tip

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.

関連情報