Enable Java* Analysis on Android* System
Explore configuration settings required to enable Java analysis with
Intel® VTune™
on an Android system:
Profiler
Enabling Java Analysis on Rooted Devices
By default, the
VTune
installs the remote collector on the target rooted Android devices with the
Profiler
--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*:
<>\bin32\amplxe-androidreg.bat --package-command=install --jitvtuneinfo=src
On Linux*:
<>/bin{32,64}/amplxe-androidreg.sh --package-command=install --jitvtuneinfo=src
VTune
updates the
Profiler
/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
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.
Enabling Java Analysis for Code Generated with ART* Compiler
To enable a source-level analysis, the
VTune
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:
Profiler
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
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:
If you run the application before the system classes are compiled, you should add another compiler option
-Ximage-compiler-option --generate-debug-info :
|