perfetto_consumer_proto::perfetto::protos

Struct HeapprofdConfig

Source
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

Source

pub fn sampling_interval_bytes(&self) -> u64

Returns the value of sampling_interval_bytes, or the default value if sampling_interval_bytes is unset.

Source

pub fn all(&self) -> bool

Returns the value of all, or the default value if all is unset.

Source

pub fn shmem_size_bytes(&self) -> u64

Returns the value of shmem_size_bytes, or the default value if shmem_size_bytes is unset.

Source

pub fn block_client(&self) -> bool

Returns the value of block_client, or the default value if block_client is unset.

Source

pub fn no_startup(&self) -> bool

Returns the value of no_startup, or the default value if no_startup is unset.

Source

pub fn no_running(&self) -> bool

Returns the value of no_running, or the default value if no_running is unset.

Source

pub fn dump_at_max(&self) -> bool

Returns the value of dump_at_max, or the default value if dump_at_max is unset.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn disable_fork_teardown(&self) -> bool

Returns the value of disable_fork_teardown, or the default value if disable_fork_teardown is unset.

Source

pub fn disable_vfork_detection(&self) -> bool

Returns the value of disable_vfork_detection, or the default value if disable_vfork_detection is unset.

Source

pub fn all_heaps(&self) -> bool

Returns the value of all_heaps, or the default value if all_heaps is unset.

Source

pub fn stream_allocations(&self) -> bool

Returns the value of stream_allocations, or the default value if stream_allocations is unset.

Source

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.

Source

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

Source§

fn clone(&self) -> HeapprofdConfig

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HeapprofdConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HeapprofdConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Message for HeapprofdConfig

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for HeapprofdConfig

Source§

fn eq(&self, other: &HeapprofdConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for HeapprofdConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.