pub struct FtraceConfig {
Show 19 fields pub ftrace_events: Vec<String>, pub atrace_categories: Vec<String>, pub atrace_apps: Vec<String>, pub buffer_size_kb: Option<u32>, pub drain_period_ms: Option<u32>, pub compact_sched: Option<CompactSchedConfig>, pub print_filter: Option<PrintFilter>, pub symbolize_ksyms: Option<bool>, pub ksyms_mem_policy: Option<i32>, pub initialize_ksyms_synchronously_for_testing: Option<bool>, pub throttle_rss_stat: Option<bool>, pub disable_generic_events: Option<bool>, pub syscall_events: Vec<String>, pub enable_function_graph: Option<bool>, pub function_filters: Vec<String>, pub function_graph_roots: Vec<String>, pub preserve_ftrace_buffer: Option<bool>, pub use_monotonic_raw_clock: Option<bool>, pub instance_name: Option<String>,
}
Expand description

Next id: 26.

Fields§

§ftrace_events: Vec<String>§atrace_categories: Vec<String>§atrace_apps: Vec<String>§buffer_size_kb: Option<u32>

Per-CPU buffer size.

§drain_period_ms: Option<u32>§compact_sched: Option<CompactSchedConfig>§print_filter: Option<PrintFilter>§symbolize_ksyms: Option<bool>

Enables symbol name resolution against /proc/kallsyms. It requires that either traced_probes is running as root or that kptr_restrict has been manually lowered. It does not disclose KASLR, symbol addresses are mangled.

§ksyms_mem_policy: Option<i32>§initialize_ksyms_synchronously_for_testing: Option<bool>
👎Deprecated

By default the kernel symbolizer is lazily initialized on a deferred task to reduce ftrace’s time-to-start-recording. Unfortunately that makes ksyms integration tests hard. This flag forces the kernel symbolizer to be initialized synchronously on the data source start and hence avoiding timing races in tests. DEPRECATED in v28 / Android U. This is now the default behavior, setting it to true is a no-op.

§throttle_rss_stat: Option<bool>

When this boolean is true AND the ftrace_events contains “kmem/rss_stat”, this option causes traced_probes to enable the “kmem/rss_stat_throttled” event instead if present, and fall back to “kmem/rss_stat” if not present. The historical context for this is the following:

  • Up to Android S (12), the rss_stat was internally throttled in its kernel implementation.
  • A change introduced in the kernels after S has introduced a new “rss_stat_throttled” making the original “rss_stat” event unthrottled (hence very spammy).
  • Not all Android T/13 devices will receive a new kernel though, hence we need to deal with both cases. For more context: go/rss-stat-throttled.
§disable_generic_events: Option<bool>

If true, avoid enabling events that aren’t statically known by traced_probes. Otherwise, the default is to emit such events as GenericFtraceEvent protos. Prefer to keep this flag at its default. This was added for Android tracing, where atrace categories and/or atrace HAL requested events can expand to events that aren’t of interest to the tracing user. Introduced in: Android T.

§syscall_events: Vec<String>

The list of syscalls that should be recorded by sys_{enter,exit} ftrace events. When empty, all syscalls are recorded. If neither sys_{enter,exit} are enabled, this setting has no effect. Example: [“sys_read”, “sys_open”]. Introduced in: Android U.

§enable_function_graph: Option<bool>

If true, enable the “function_graph” kernel tracer that emits events whenever a kernel function is entered and exited (funcgraph_entry/funcgraph_exit). Notes on use:

  • Requires |symbolize_ksyms| for function name resolution.
  • Use |function_filters| or |function_graph_roots| to constrain the traced set of functions, otherwise the event bandwidth will be too high for practical use.
  • The data source might be rejected if there is already a concurrent ftrace data source that does not use function graph itself, as we do not support switching kernel tracers mid-trace.
  • Requires a kernel compiled with CONFIG_FUNCTION_GRAPH_TRACER. This is enabled if “cat /sys/kernel/tracing/available_tracers” includes “function_graph”. Android:
  • Available only on debuggable builds.
  • Introduced in: Android U.
§function_filters: Vec<String>

Constrains the set of functions traced when |enable_function_graph| is true. Supports globs, e.g. “sched*”. You can specify multiple filters, in which case all matching functions will be traced. See kernel documentation on ftrace “set_ftrace_filter” file for more details. Android:

  • Available only on debuggable builds.
  • Introduced in: Android U.
§function_graph_roots: Vec<String>

If |enable_function_graph| is true, trace this set of functions and all of its callees. Supports globs. Can be set together with |function_filters|, in which case only callees matching the filter will be traced. If setting both, you most likely want all roots to also be included in |function_filters|. Android:

  • Available only on debuggable builds.
  • Introduced in: Android U.
§preserve_ftrace_buffer: Option<bool>

If true, does not clear ftrace buffers before the start of the program. This makes sense only if this is the first ftrace data source instance created after the daemon has been started. Can be useful for gathering boot traces, if ftrace has been separately configured (e.g. via kernel commandline).

§use_monotonic_raw_clock: Option<bool>

If true, overrides the default timestamp clock and uses a raw hardware based monotonic clock for getting timestamps.

  • Introduced in: Android U.
§instance_name: Option<String>

If |instance_name| is not empty, then attempt to use that tracefs instance for event recording. Normally, this means /sys/kernel/tracing/instances/$instance_name.

The name “hyp” is reserved.

The instance must already exist, the tracing daemon will not create it for you as it typically doesn’t have such permissions. Only a subset of features is guaranteed to work with non-default instances, at the time of writing:

  • ftrace_events
  • buffer_size_kb

Implementations§

source§

impl FtraceConfig

source

pub fn buffer_size_kb(&self) -> u32

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

source

pub fn drain_period_ms(&self) -> u32

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

source

pub fn symbolize_ksyms(&self) -> bool

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

source

pub fn initialize_ksyms_synchronously_for_testing(&self) -> bool

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

source

pub fn throttle_rss_stat(&self) -> bool

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

source

pub fn disable_generic_events(&self) -> bool

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

source

pub fn ksyms_mem_policy(&self) -> KsymsMemPolicy

Returns the enum value of ksyms_mem_policy, or the default if the field is unset or set to an invalid enum value.

source

pub fn set_ksyms_mem_policy(&mut self, value: KsymsMemPolicy)

Sets ksyms_mem_policy to the provided enum value.

source

pub fn enable_function_graph(&self) -> bool

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

source

pub fn preserve_ftrace_buffer(&self) -> bool

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

source

pub fn use_monotonic_raw_clock(&self) -> bool

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

source

pub fn instance_name(&self) -> &str

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

Trait Implementations§

source§

impl Clone for FtraceConfig

source§

fn clone(&self) -> FtraceConfig

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 FtraceConfig

source§

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

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

impl Default for FtraceConfig

source§

fn default() -> Self

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

impl Message for FtraceConfig

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 FtraceConfig

source§

fn eq(&self, other: &FtraceConfig) -> 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 FtraceConfig

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.