xref: /aosp_15_r20/art/tools/jvmti-agents/jit-load/README.md (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker# jitload
2*795d594fSAndroid Build Coastguard Worker
3*795d594fSAndroid Build Coastguard WorkerJitload is an art-specific agent allowing one to count the number of classes
4*795d594fSAndroid Build Coastguard Workerloaded on the jit-thread or verify that none were.
5*795d594fSAndroid Build Coastguard Worker
6*795d594fSAndroid Build Coastguard Worker# Usage
7*795d594fSAndroid Build Coastguard Worker### Build
8*795d594fSAndroid Build Coastguard Worker>    `m libjitload`  # or 'm libjitloadd' with debugging checks enabled
9*795d594fSAndroid Build Coastguard Worker
10*795d594fSAndroid Build Coastguard WorkerThe libraries will be built for 32-bit, 64-bit, host and target. Below examples assume you want to use the 64-bit version.
11*795d594fSAndroid Build Coastguard Worker### Command Line
12*795d594fSAndroid Build Coastguard Worker
13*795d594fSAndroid Build Coastguard Worker>    `art -Xplugin:$ANDROID_HOST_OUT/lib64/libopenjdkjvmti.so -agentpath:$ANDROID_HOST_OUT/lib64/libjitload.so -cp tmp/java/helloworld.dex -Xint helloworld`
14*795d594fSAndroid Build Coastguard Worker
15*795d594fSAndroid Build Coastguard Worker* `-Xplugin` and `-agentpath` need to be used, otherwise libtitrace agent will fail during init.
16*795d594fSAndroid Build Coastguard Worker* If using `libartd.so`, make sure to use the debug version of jvmti and agent.
17*795d594fSAndroid Build Coastguard Worker* Pass the '=fatal' option to the agent to cause it to abort if any classes are
18*795d594fSAndroid Build Coastguard Worker  loaded on a jit thread. Otherwise a warning will be printed.
19*795d594fSAndroid Build Coastguard Worker
20*795d594fSAndroid Build Coastguard Worker>    `art -d -Xplugin:$ANDROID_HOST_OUT/lib64/libopenjdkjvmtid.so -agentpath:$ANDROID_HOST_OUT/lib64/libjitloadd.so=fatal -cp tmp/java/helloworld.dex -Xint helloworld`
21*795d594fSAndroid Build Coastguard Worker
22*795d594fSAndroid Build Coastguard Worker* To use with run-test or testrunner.py use the --with-agent argument.
23*795d594fSAndroid Build Coastguard Worker
24*795d594fSAndroid Build Coastguard Worker>    `./test/run-test --host --with-agent libtitraced.so=fatal 001-HelloWorld`
25*795d594fSAndroid Build Coastguard Worker
26*795d594fSAndroid Build Coastguard Worker
27*795d594fSAndroid Build Coastguard Worker### Printing the Results
28*795d594fSAndroid Build Coastguard WorkerAll statistics gathered during the trace are printed automatically when the
29*795d594fSAndroid Build Coastguard Workerprogram normally exits. In the case of Android applications, they are always
30*795d594fSAndroid Build Coastguard Workerkilled, so we need to manually print the results.
31*795d594fSAndroid Build Coastguard Worker
32*795d594fSAndroid Build Coastguard Worker>    `kill -SIGQUIT $(pid com.example.android.displayingbitmaps)`
33*795d594fSAndroid Build Coastguard Worker
34*795d594fSAndroid Build Coastguard WorkerWill initiate a dump of the counts (to logcat).
35*795d594fSAndroid Build Coastguard Worker
36