1# JIT symbols 2 3[TOC] 4 5## Java JIT symbols 6 7On Android >= P, simpleperf supports profiling Java code, no matter whether it is executed by 8the interpreter, or JITed, or compiled into native instructions. So you don't need to do anything. 9 10For details on Android O and N, see 11[android_application_profiling.md](./android_application_profiling.md#prepare-an-android-application). 12 13## Generic JIT symbols 14 15Simpleperf supports picking up symbols from per-pid symbol map files, somewhat similar to what 16Linux kernel perftool does. Application should create those files at specific locations. 17 18### Symbol map file location for application 19 20Application should create symbol map files in its data directory. 21 22For example, process `123` of application `foo.bar.baz` should create 23`/data/data/foo.bar.baz/perf-123.map`. 24 25### Symbol map file location for standalone program 26 27Standalone programs should create symbol map files in `/data/local/tmp`. 28 29For example, standalone program process `123` should create `/data/local/tmp/perf-123.map`. 30 31### Symbol map file format 32 33Symbol map file is a text file. 34 35Every line describes a new symbol. Line format is: 36``` 37<symbol-absolute-address> <symbol-size> <symbol-name> 38``` 39 40For example: 41``` 420x10000000 0x16 jit_symbol_one 430x20000000 0x332 jit_symbol_two 440x20002004 0x8 jit_symbol_three 45``` 46 47All characters after the symbol size and until the end of the line are parsed as the symbol name, 48with leading and trailing spaces removed. This means spaces are allowed in symbol names themselves. 49 50### Known issues 51 52Current implementation gets confused if memory pages where JIT symbols reside are reused by mapping 53a file either before or after. 54 55For example, if memory pages were first used by `dlopen("libfoo.so")`, then freed by `dlclose`, 56then allocated for JIT symbols - simpleperf will report symbols from `libfoo.so` instead. 57