pub struct PerfEventConfig {
Show 17 fields pub timebase: Option<Timebase>, pub callstack_sampling: Option<CallstackSampling>, pub ring_buffer_read_period_ms: Option<u32>, pub ring_buffer_pages: Option<u32>, pub max_enqueued_footprint_kb: Option<u64>, pub max_daemon_memory_kb: Option<u32>, pub remote_descriptor_timeout_ms: Option<u32>, pub unwind_state_clear_period_ms: Option<u32>, pub target_installed_by: Vec<String>, pub all_cpus: Option<bool>, pub sampling_frequency: Option<u32>, pub kernel_frames: Option<bool>, pub target_pid: Vec<i32>, pub target_cmdline: Vec<String>, pub exclude_pid: Vec<i32>, pub exclude_cmdline: Vec<String>, pub additional_cmdline_count: Option<u32>,
}
Expand description

Configuration for the traced_perf profiler.

Example config for basic cpu profiling: perf_event_config { timebase { frequency: 80 } callstack_sampling { scope { target_cmdline: “surfaceflinger” target_cmdline: “system_server” } kernel_frames: true } }

Next id: 19

Fields§

§timebase: Option<Timebase>

What event to sample on, and how often. Defined in common/perf_events.proto.

§callstack_sampling: Option<CallstackSampling>

If set, the profiler will sample userspace processes’ callstacks at the interval specified by the |timebase|. If unset, the profiler will record only the event counts.

§ring_buffer_read_period_ms: Option<u32>

How often the per-cpu ring buffers are read by the producer. If unset, an implementation-defined default is used.

§ring_buffer_pages: Option<u32>

Size (in 4k pages) of each per-cpu ring buffer that is filled by the kernel. If set, must be a power of two. If unset, an implementation-defined default is used.

§max_enqueued_footprint_kb: Option<u64>

Drop samples if the heap memory held by the samples in the unwinder queue is above the given limit. This counts the memory across all concurrent data sources (not just this one’s), and there is no fairness guarantee - the whole quota might be used up by a concurrent source.

§max_daemon_memory_kb: Option<u32>

Stop the data source if traced_perf’s combined {RssAnon + Swap} memory footprint exceeds this value.

§remote_descriptor_timeout_ms: Option<u32>

Timeout for the remote /proc//{maps,mem} file descriptors for a sampled process. This is primarily for Android, where this lookup is asynchronous. As long as the producer is waiting, the associated samples will be kept enqueued (putting pressure on the capacity of the shared unwinding queue). Once a lookup for a process expires, all associated samples are discarded. However, if the lookup still succeeds after the timeout, future samples will be handled normally. If unset, an implementation-defined default is used.

§unwind_state_clear_period_ms: Option<u32>

Optional period for clearing state cached by the unwinder. This is a heavy operation that is only necessary for traces that target a wide set of processes, and require the memory footprint to be reset periodically. If unset, the cached state will not be cleared.

§target_installed_by: Vec<String>

If set, only profile target if it was installed by a package with one of these names. Special values:

  • “@system”: installed on the system partition
  • “@product”: installed on the product partition
  • “@null”: sideloaded Supported on Android 12+.
§all_cpus: Option<bool>

Note: legacy configs had to set |all_cpus| to true to pass parsing. We rely on this to detect such configs.

§sampling_frequency: Option<u32>§kernel_frames: Option<bool>§target_pid: Vec<i32>§target_cmdline: Vec<String>§exclude_pid: Vec<i32>§exclude_cmdline: Vec<String>§additional_cmdline_count: Option<u32>

Implementations§

source§

impl PerfEventConfig

source

pub fn all_cpus(&self) -> bool

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

source

pub fn sampling_frequency(&self) -> u32

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

source

pub fn ring_buffer_pages(&self) -> u32

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

source

pub fn ring_buffer_read_period_ms(&self) -> u32

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

source

pub fn remote_descriptor_timeout_ms(&self) -> u32

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

source

pub fn unwind_state_clear_period_ms(&self) -> u32

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

source

pub fn additional_cmdline_count(&self) -> u32

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

source

pub fn kernel_frames(&self) -> bool

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

source

pub fn max_daemon_memory_kb(&self) -> u32

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

source

pub fn max_enqueued_footprint_kb(&self) -> u64

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

Trait Implementations§

source§

impl Clone for PerfEventConfig

source§

fn clone(&self) -> PerfEventConfig

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 PerfEventConfig

source§

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

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

impl Default for PerfEventConfig

source§

fn default() -> Self

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

impl Message for PerfEventConfig

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 PerfEventConfig

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for PerfEventConfig

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§

default 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,

§

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>,

§

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>,

§

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.