• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# heap_profile
2
3`tools/heap_profile` allows to collect native memory profiles on Android.
4See [Recording traces](/docs/data-sources/native-heap-profiler.md) for more
5details about the data-source.
6
7```
8usage: heap_profile [-h] [-i INTERVAL] [-d DURATION] [--no-start] [-p PIDS]
9                    [-n NAMES] [-c CONTINUOUS_DUMP] [--disable-selinux]
10                    [--no-versions] [--no-running] [--no-startup]
11                    [--shmem-size SHMEM_SIZE] [--block-client]
12                    [--block-client-timeout BLOCK_CLIENT_TIMEOUT]
13                    [--no-block-client] [--idle-allocations] [--dump-at-max]
14                    [--disable-fork-teardown] [--simpleperf]
15                    [--trace-to-text-binary TRACE_TO_TEXT_BINARY]
16                    [--print-config] [-o DIRECTORY]
17```
18
19## Options
20|Option|Description|
21|---|---|
22| -n, --name | Comma-separated list of process names to profile. |
23| -p, --pid | Comma-separated list of PIDs to profile. |
24| -i, --interval | Sampling interval. Default 4096 (4KiB) |
25| -o, --output | Output directory. |
26| -d, --duration | Duration of profile (ms). Default 7 days. |
27| --block-client | 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 |
28| --no-block-client | When buffer is full, stop the profile early. |
29| --block-client-timeout | If --block-client is given, do not block any allocation for longer than this timeout (us). |
30| -h, --help | Show this help message and exit |
31| --no-start | Do not start heapprofd. |
32| -c, --continuous-dump | Dump interval in ms. 0 to disable continuous dump. |
33| --disable-selinux | Disable SELinux enforcement for duration of profile. |
34| --no-versions | Do not get version information about APKs. |
35| --no-running | Do not target already running processes. Requires Android 11. |
36| --no-startup | Do not target processes that start during the profile. Requires Android 11. |
37| --shmem-size | Size of buffer between client and heapprofd. Default 8MiB. Needs to be a power of two multiple of 4096, at least 8192. |
38| --dump-at-max | Dump the maximum memory usage rather than at the time of the dump. |
39| --disable-fork-teardown | Do not tear down client in forks. This can be useful for programs that use vfork. Android 11+ only. |
40| --simpleperf | Get simpleperf profile of heapprofd. This is only for heapprofd development. |
41| --trace-to-text-binary | Path to local trace to text. For debugging. |
42| --print-config | Print config instead of running. For debugging. |
43