pub struct HeapprofdConfig {Show 25 fields
pub sampling_interval_bytes: Option<u64>,
pub adaptive_sampling_shmem_threshold: Option<u64>,
pub adaptive_sampling_max_sampling_interval_bytes: Option<u64>,
pub process_cmdline: Vec<String>,
pub pid: Vec<u64>,
pub target_installed_by: Vec<String>,
pub heaps: Vec<String>,
pub exclude_heaps: Vec<String>,
pub stream_allocations: Option<bool>,
pub heap_sampling_intervals: Vec<u64>,
pub all_heaps: Option<bool>,
pub all: Option<bool>,
pub min_anonymous_memory_kb: Option<u32>,
pub max_heapprofd_memory_kb: Option<u32>,
pub max_heapprofd_cpu_secs: Option<u64>,
pub skip_symbol_prefix: Vec<String>,
pub continuous_dump_config: Option<ContinuousDumpConfig>,
pub shmem_size_bytes: Option<u64>,
pub block_client: Option<bool>,
pub block_client_timeout_us: Option<u32>,
pub no_startup: Option<bool>,
pub no_running: Option<bool>,
pub dump_at_max: Option<bool>,
pub disable_fork_teardown: Option<bool>,
pub disable_vfork_detection: Option<bool>,
}
Expand description
Configuration for go/heapprofd. Next id: 28
Fields§
§sampling_interval_bytes: Option<u64>
Sampling rate for all heaps not specified via heap_sampling_intervals.
These are:
- All heaps if heap_sampling_intervals is empty.
- Those profiled due to all_heaps and not named in heaps if heap_sampling_intervals is not empty.
- The implicit libc.malloc heap if heaps is empty.
Set to 1 for perfect accuracy. Otherwise, sample every sample_interval_bytes on average.
See https://perfetto.dev/docs/data-sources/native-heap-profiler#sampling-interval for more details.
BUGS Before Android 12, setting this to 0 would crash the target process.
N.B. This must be explicitly set to a non-zero value for all heaps (with this field or with heap_sampling_intervals), otherwise the producer will not start.
adaptive_sampling_shmem_threshold: Option<u64>
If less than the given numbers of bytes are left free in the shared memory buffer, increase sampling interval by a factor of two. Adaptive sampling is disabled when set to 0.
adaptive_sampling_max_sampling_interval_bytes: Option<u64>
Stop doubling the sampling_interval once the sampling interval has reached this value.
process_cmdline: Vec<String>
E.g. surfaceflinger, com.android.phone This input is normalized in the following way: if it contains slashes, everything up to the last slash is discarded. If it contains “@”, everything after the first @ is discared. E.g. /system/bin/surfaceflinger@1.0 normalizes to surfaceflinger. This transformation is also applied to the processes’ command lines when matching.
pid: Vec<u64>
For watermark based triggering or local debugging.
target_installed_by: Vec<String>
Only profile target if it was installed by one of the packages given. Special values are:
- @system: installed on the system partition
- @product: installed on the product partition
- @null: sideloaded Supported on Android 12+.
heaps: Vec<String>
Which heaps to sample, e.g. “libc.malloc”. If left empty, only samples “malloc”.
Introduced in Android 12.
exclude_heaps: Vec<String>
Which heaps not to sample, e.g. “libc.malloc”. This is useful when used in combination with all_heaps;
Introduced in Android 12.
stream_allocations: Option<bool>
§heap_sampling_intervals: Vec<u64>
If given, needs to be the same length as heaps and gives the sampling interval for the respective entry in heaps.
Otherwise, sampling_interval_bytes is used.
It is recommended to set sampling_interval_bytes to a reasonable default value when using this, as a value of 0 for sampling_interval_bytes will crash the target process before Android 12.
Introduced in Android 12.
All values must be non-zero or the producer will not start.
all_heaps: Option<bool>
Sample all heaps registered by target process. Introduced in Android 12.
all: Option<bool>
Profile all processes eligible for profiling on the system. See https://perfetto.dev/docs/data-sources/native-heap-profiler#heapprofd-targets for which processes are eligible.
On unmodified userdebug builds, this will lead to system crashes. Zygote will crash when trying to launch a new process as it will have an unexpected open socket to heapprofd.
heapprofd will likely be overloaded by the amount of data for low sampling intervals.
min_anonymous_memory_kb: Option<u32>
Do not profile processes whose anon RSS + swap < given value. Introduced in Android 11.
max_heapprofd_memory_kb: Option<u32>
Stop profile if heapprofd memory usage goes beyond the given value. Introduced in Android 11.
max_heapprofd_cpu_secs: Option<u64>
Stop profile if heapprofd CPU time since start of this data-source goes beyond given value. Introduced in Android 11.
skip_symbol_prefix: Vec<String>
Do not emit function names for mappings starting with this prefix. E.g. /system to not emit symbols for any system libraries.
continuous_dump_config: Option<ContinuousDumpConfig>
Dump at a predefined interval.
shmem_size_bytes: Option<u64>
Size of the shared memory buffer between the profiled processes and heapprofd. Defaults to 8 MiB. If larger than 500 MiB, truncated to 500 MiB.
Needs to be:
- at least 8192,
- a power of two,
- a multiple of 4096.
block_client: Option<bool>
When the shmem buffer is full, block the client instead of ending the trace. Use with caution as this will significantly slow down the target process.
block_client_timeout_us: Option<u32>
If set, stop the trace session after blocking the client for this timeout. Needs to be larger than 100 us, otherwise no retries are done. Introduced in Android 11.
no_startup: Option<bool>
Do not profile processes from startup, only match already running processes.
Can not be set at the same time as no_running. Introduced in Android 11.
no_running: Option<bool>
Do not profile running processes. Only match processes on startup.
Can not be set at the same time as no_startup. Introduced in Android 11.
dump_at_max: Option<bool>
Cause heapprofd to emit a single dump at the end, showing the memory usage at the point in time when the sampled heap usage of the process was at its maximum. This causes ProfilePacket.HeapSample.self_max to be set, and self_allocated and self_freed to not be set. Introduced in Android 11.
disable_fork_teardown: Option<bool>
Escape hatch if the session is being torn down because of a forked child that shares memory space, but is not correctly identified as a vforked child. Introduced in Android 11.
disable_vfork_detection: Option<bool>
We try to automatically detect when a target applicatation vforks but then does a memory allocation (or free). This auto-detection can be disabled with this. Introduced in Android 11.
Implementations§
Source§impl HeapprofdConfig
impl HeapprofdConfig
Sourcepub fn sampling_interval_bytes(&self) -> u64
pub fn sampling_interval_bytes(&self) -> u64
Returns the value of sampling_interval_bytes
, or the default value if sampling_interval_bytes
is unset.
Sourcepub fn shmem_size_bytes(&self) -> u64
pub fn shmem_size_bytes(&self) -> u64
Returns the value of shmem_size_bytes
, or the default value if shmem_size_bytes
is unset.
Sourcepub fn block_client(&self) -> bool
pub fn block_client(&self) -> bool
Returns the value of block_client
, or the default value if block_client
is unset.
Sourcepub fn no_startup(&self) -> bool
pub fn no_startup(&self) -> bool
Returns the value of no_startup
, or the default value if no_startup
is unset.
Sourcepub fn no_running(&self) -> bool
pub fn no_running(&self) -> bool
Returns the value of no_running
, or the default value if no_running
is unset.
Sourcepub fn dump_at_max(&self) -> bool
pub fn dump_at_max(&self) -> bool
Returns the value of dump_at_max
, or the default value if dump_at_max
is unset.
Sourcepub fn block_client_timeout_us(&self) -> u32
pub fn block_client_timeout_us(&self) -> u32
Returns the value of block_client_timeout_us
, or the default value if block_client_timeout_us
is unset.
Sourcepub fn min_anonymous_memory_kb(&self) -> u32
pub fn min_anonymous_memory_kb(&self) -> u32
Returns the value of min_anonymous_memory_kb
, or the default value if min_anonymous_memory_kb
is unset.
Sourcepub fn max_heapprofd_memory_kb(&self) -> u32
pub fn max_heapprofd_memory_kb(&self) -> u32
Returns the value of max_heapprofd_memory_kb
, or the default value if max_heapprofd_memory_kb
is unset.
Sourcepub fn max_heapprofd_cpu_secs(&self) -> u64
pub fn max_heapprofd_cpu_secs(&self) -> u64
Returns the value of max_heapprofd_cpu_secs
, or the default value if max_heapprofd_cpu_secs
is unset.
Sourcepub fn disable_fork_teardown(&self) -> bool
pub fn disable_fork_teardown(&self) -> bool
Returns the value of disable_fork_teardown
, or the default value if disable_fork_teardown
is unset.
Sourcepub fn disable_vfork_detection(&self) -> bool
pub fn disable_vfork_detection(&self) -> bool
Returns the value of disable_vfork_detection
, or the default value if disable_vfork_detection
is unset.
Sourcepub fn all_heaps(&self) -> bool
pub fn all_heaps(&self) -> bool
Returns the value of all_heaps
, or the default value if all_heaps
is unset.
Sourcepub fn stream_allocations(&self) -> bool
pub fn stream_allocations(&self) -> bool
Returns the value of stream_allocations
, or the default value if stream_allocations
is unset.
Sourcepub fn adaptive_sampling_shmem_threshold(&self) -> u64
pub fn adaptive_sampling_shmem_threshold(&self) -> u64
Returns the value of adaptive_sampling_shmem_threshold
, or the default value if adaptive_sampling_shmem_threshold
is unset.
Sourcepub fn adaptive_sampling_max_sampling_interval_bytes(&self) -> u64
pub fn adaptive_sampling_max_sampling_interval_bytes(&self) -> u64
Returns the value of adaptive_sampling_max_sampling_interval_bytes
, or the default value if adaptive_sampling_max_sampling_interval_bytes
is unset.
Trait Implementations§
Source§impl Clone for HeapprofdConfig
impl Clone for HeapprofdConfig
Source§fn clone(&self) -> HeapprofdConfig
fn clone(&self) -> HeapprofdConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for HeapprofdConfig
impl Debug for HeapprofdConfig
Source§impl Default for HeapprofdConfig
impl Default for HeapprofdConfig
Source§impl Message for HeapprofdConfig
impl Message for HeapprofdConfig
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
Source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>where
B: BufMut,
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
Source§fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>where
B: Buf,
Self: Default,
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
self
. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>where
B: Buf,
Self: Sized,
self
.Source§impl PartialEq for HeapprofdConfig
impl PartialEq for HeapprofdConfig
impl StructuralPartialEq for HeapprofdConfig
Auto Trait Implementations§
impl Freeze for HeapprofdConfig
impl RefUnwindSafe for HeapprofdConfig
impl Send for HeapprofdConfig
impl Sync for HeapprofdConfig
impl Unpin for HeapprofdConfig
impl UnwindSafe for HeapprofdConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)