If you do play around with the config directly, you can actually configure a "track all allocaitons" mode but in practice this is not super useful: either you end up slowing the device to a complete crawl or you drop lots of data as you just cannot keep up. [1]
In practice, we've found a sampling of 4096 (the default) to provide a very good tradeoff between accuracy and performance.
[1] The option is called `sampling_interval_bytes` and, as the documentation describes (https://perfetto.dev/docs/reference/trace-config-proto#Heapp...), setting it to `1` means perfect accuracy. You usually will also want `block_client` so that the data isn't dropped (but as noted there it slows down the device a lot).
It samples the heap via Poisson sampling (https://perfetto.dev/docs/design-docs/heapprofd-sampling) so that large allocations are certain to be sampled and small allocations are more likely to be dropped.
If you do play around with the config directly, you can actually configure a "track all allocaitons" mode but in practice this is not super useful: either you end up slowing the device to a complete crawl or you drop lots of data as you just cannot keep up. [1]
In practice, we've found a sampling of 4096 (the default) to provide a very good tradeoff between accuracy and performance.
[1] The option is called `sampling_interval_bytes` and, as the documentation describes (https://perfetto.dev/docs/reference/trace-config-proto#Heapp...), setting it to `1` means perfect accuracy. You usually will also want `block_client` so that the data isn't dropped (but as noted there it slows down the device a lot).