xref: /aosp_15_r20/external/perfetto/docs/reference/heap_profile-cli.md (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# HEAP_PROFILE(1)
2
3## NAME
4
5heap_profile - record heap profile on Android device
6
7## DESCRIPTION
8
9`tools/heap_profile` allows to collect native memory profiles on Android.
10See [Recording traces](/docs/data-sources/native-heap-profiler.md) for more
11details about the data-source.
12
13```
14usage: heap_profile [-h] [-i INTERVAL] [-d DURATION] [--no-start] [-p PIDS]
15                    [-n NAMES] [-c CONTINUOUS_DUMP] [--disable-selinux]
16                    [--no-versions] [--no-running] [--no-startup]
17                    [--shmem-size SHMEM_SIZE] [--block-client]
18                    [--block-client-timeout BLOCK_CLIENT_TIMEOUT]
19                    [--no-block-client] [--idle-allocations] [--dump-at-max]
20                    [--disable-fork-teardown] [--simpleperf]
21                    [--traceconv-binary TRACECONV_BINARY]
22                    [--print-config] [-o DIRECTORY]
23```
24
25## OPTIONS
26`-n`, `--name` _NAMES_
27:    Comma-separated list of process names to profile.
28
29`-p`, `--pid` _PIDS_
30:    Comma-separated list of PIDs to profile.
31
32`-i`, `--interval`
33:    Sampling interval. Default 4096 (4KiB)
34
35`-o`, `--output` _DIRECTORY_
36:    Output directory.
37
38`--all-heaps`
39:    Collect allocations from all heaps registered by target.
40
41`--block-client`
42:    When buffer is full, block the client to wait for buffer space. Use with caution as this can significantly slow down the client. This is the default
43
44`--block-client-timeout`
45:    If --block-client is given, do not block any allocation for longer than this timeout (us).
46
47`-c`, `--continuous-dump`
48:    Dump interval in ms. 0 to disable continuous dump.
49
50`-d`, `--duration`
51:    Duration of profile (ms). 0 to run until interrupted. Default: until interrupted by user.
52
53`--disable-fork-teardown`
54:    Do not tear down client in forks. This can be useful for programs that use vfork. Android 11+ only.
55
56`--disable-selinux`
57:    Disable SELinux enforcement for duration of profile.
58
59`--dump-at-max`
60:    Dump the maximum memory usage rather than at the time of the dump.
61
62`-h`, `--help`
63:    show this help message and exit
64
65`--heaps` _HEAPS_
66:    Comma-separated list of heaps to collect, e.g: malloc,art. Requires Android 12.
67
68`--idle-allocations`
69:    Keep track of how many bytes were unused since the last dump, per callstack
70
71`--no-android-tree-symbolization`
72:    Do not symbolize using currently lunched target in the Android tree.
73
74`--no-block-client`
75:    When buffer is full, stop the profile early.
76
77`--no-running`
78:    Do not target already running processes. Requires Android 11.
79
80`--no-start`
81:    Do not start heapprofd.
82
83`--no-startup`
84:    Do not target processes that start during the profile. Requires Android 11.
85
86`--no-versions`
87:    Do not get version information about APKs.
88
89`--print-config`
90:    Print config instead of running. For debugging.
91
92`--shmem-size`
93:    Size of buffer between client and heapprofd. Default 8MiB. Needs to be a power of two multiple of 4096, at least 8192.
94
95`--simpleperf`
96:    Get simpleperf profile of heapprofd. This is only for heapprofd development.
97
98`--traceconv-binary`
99:    Path to local trace to text. For debugging.
100