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