tracing_perfetto_sdk_schema

Struct TraceConfig

Source
pub struct TraceConfig {
Show 35 fields pub buffers: Vec<BufferConfig>, pub data_sources: Vec<DataSource>, pub builtin_data_sources: Option<BuiltinDataSource>, pub duration_ms: Option<u32>, pub prefer_suspend_clock_for_duration: Option<bool>, pub enable_extra_guardrails: Option<bool>, pub lockdown_mode: Option<i32>, pub producers: Vec<ProducerConfig>, pub statsd_metadata: Option<StatsdMetadata>, pub write_into_file: Option<bool>, pub output_path: Option<String>, pub file_write_period_ms: Option<u32>, pub max_file_size_bytes: Option<u64>, pub guardrail_overrides: Option<GuardrailOverrides>, pub deferred_start: Option<bool>, pub flush_period_ms: Option<u32>, pub flush_timeout_ms: Option<u32>, pub data_source_stop_timeout_ms: Option<u32>, pub notify_traceur: Option<bool>, pub bugreport_score: Option<i32>, pub bugreport_filename: Option<String>, pub trigger_config: Option<TriggerConfig>, pub activate_triggers: Vec<String>, pub incremental_state_config: Option<IncrementalStateConfig>, pub allow_user_build_tracing: Option<bool>, pub unique_session_name: Option<String>, pub compression_type: Option<i32>, pub incident_report_config: Option<IncidentReportConfig>, pub statsd_logging: Option<i32>, pub trace_uuid_msb: Option<i64>, pub trace_uuid_lsb: Option<i64>, pub trace_filter: Option<TraceFilter>, pub android_report_config: Option<AndroidReportConfig>, pub cmd_trace_start_delay: Option<CmdTraceStartDelay>, pub session_semaphores: Vec<SessionSemaphore>,
}
Expand description

The overall config that is used when starting a new tracing session through ProducerPort::StartTracing(). It contains the general config for the logging buffer(s) and the configs for all the data source being enabled.

Next id: 40.

Fields§

§buffers: Vec<BufferConfig>§data_sources: Vec<DataSource>§builtin_data_sources: Option<BuiltinDataSource>§duration_ms: Option<u32>

If specified, the trace will be stopped |duration_ms| after starting. This does not count the time the system is suspended, so we will run for duration_ms of system activity, not wall time.

However in case of traces with triggers, see TriggerConfig.trigger_timeout_ms instead.

§prefer_suspend_clock_for_duration: Option<bool>

If true, tries to use CLOCK_BOOTTIME for duration_ms rather than CLOCK_MONOTONIC (which doesn’t count time in suspend). Supported only on Linux/Android, no-op on other platforms. This is used when dealing with long (e.g. 24h) traces, where suspend can inflate them to weeks of wall-time, making them more likely to hit device reboots (and hence loss). This option also changes consistently the semantic of TriggerConfig.stop_delay_ms.

§enable_extra_guardrails: Option<bool>

This is set when –dropbox is passed to the Perfetto command line client and enables guardrails that limit resource usage for traces requested by statsd.

§lockdown_mode: Option<i32>

Reject producers that are not running under the same UID as the tracing service.

§producers: Vec<ProducerConfig>§statsd_metadata: Option<StatsdMetadata>

Statsd-specific metadata.

§write_into_file: Option<bool>

When true && |output_path| is empty, the EnableTracing() request must provide a file descriptor. The service will then periodically read packets out of the trace buffer and store it into the passed file. If |output_path| is not empty no fd should be passed, the service will create a new file and write into that (see comment below).

§output_path: Option<String>

This must point to a non-existing file. If the file exists the service will NOT overwrite and will fail instead as a security precaution. On Android, when this is used with the system traced, the path must be within /data/misc/perfetto-traces/ or the trace will fail. This option has been introduced in Android R. Before R write_into_file can be used only with the “pass a file descriptor over IPC” mode.

§file_write_period_ms: Option<u32>

Optional. If non-zero tunes the write period. A min value of 100ms is enforced (i.e. smaller values are ignored).

§max_file_size_bytes: Option<u64>

Optional. When non zero the periodic write stops once at most X bytes have been written into the file. Tracing is disabled when this limit is reached, even if |duration_ms| has not been reached yet.

§guardrail_overrides: Option<GuardrailOverrides>§deferred_start: Option<bool>

When true, data sources are not started until an explicit call to StartTracing() on the consumer port. This is to support early initialization and fast trace triggering. This can be used only when the Consumer explicitly triggers the StartTracing() method. This should not be used in a remote trace config via statsd, doing so will result in a hung trace session.

§flush_period_ms: Option<u32>

When set, it periodically issues a Flush() to all data source, forcing them to commit their data into the tracing service. This can be used for quasi-real-time streaming mode and to guarantee some partial ordering of events in the trace in windows of X ms.

§flush_timeout_ms: Option<u32>

Wait for this long for producers to acknowledge flush requests. Default 5s.

§data_source_stop_timeout_ms: Option<u32>

Wait for this long for producers to acknowledge stop requests. Default 5s.

§notify_traceur: Option<bool>

Android-only. If set, sends an intent to the Traceur system app when the trace ends to notify it about the trace readiness.

§bugreport_score: Option<i32>

This field was introduced in Android S. Android-only. If set to a value > 0, marks the trace session as a candidate for being attached to a bugreport. This field effectively acts as a z-index for bugreports. When Android’s dumpstate runs perfetto –save-for-bugreport, traced will pick the tracing session with the highest score (score <= 0 is ignored) and: On Android S, T: will steal its contents, save the trace into a known path and stop prematurely. On Android U+: will create a read-only snapshot and save that into a known path, without stoppin the original tracing session. When this field is set the tracing session becomes eligible to be cloned by other UIDs.

§bugreport_filename: Option<String>

When set, defines name of the file that will be saved under /data/misc/perfetto-traces/bugreport/ when using –save-all-for-bugreport. If omitted, traces will be named systrace.pftrace, systrace_1.pftrace, etc, starting from the highest bugreport_score. Introduced in v42 / Android V.

§trigger_config: Option<TriggerConfig>§activate_triggers: Vec<String>

When this is non-empty the perfetto command line tool will ignore the rest of this TraceConfig and instead connect to the perfetto service as a producer and send these triggers, potentially stopping or starting traces that were previous configured to use a TriggerConfig.

§incremental_state_config: Option<IncrementalStateConfig>§allow_user_build_tracing: Option<bool>

Additional guardrail used by the Perfetto command line client. On user builds when –dropbox is set perfetto will refuse to trace unless this is also set. Added in Q.

§unique_session_name: Option<String>

If set the tracing service will ensure there is at most one tracing session with this key.

§compression_type: Option<i32>§incident_report_config: Option<IncidentReportConfig>§statsd_logging: Option<i32>

Android-only. Not for general use. If specified, sets the logging to statsd of guardrails and checkpoints in the tracing service. perfetto_cmd sets this to enabled (if not explicitly set in the config) when specifying –upload.

§trace_uuid_msb: Option<i64>
👎Deprecated

An identifier clients can use to tie this trace to other logging. DEPRECATED as per v32. See TracePacket.trace_uuid for the authoritative Trace UUID. If this field is set, the tracing service will respect the requested UUID (i.e. TracePacket.trace_uuid == this field) but only if gap-less snapshotting is not used.

§trace_uuid_lsb: Option<i64>
👎Deprecated
§trace_filter: Option<TraceFilter>§android_report_config: Option<AndroidReportConfig>§cmd_trace_start_delay: Option<CmdTraceStartDelay>§session_semaphores: Vec<SessionSemaphore>

Implementations§

Source§

impl TraceConfig

Source

pub fn duration_ms(&self) -> u32

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

Source

pub fn enable_extra_guardrails(&self) -> bool

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

Source

pub fn lockdown_mode(&self) -> LockdownModeOperation

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

Source

pub fn set_lockdown_mode(&mut self, value: LockdownModeOperation)

Sets lockdown_mode to the provided enum value.

Source

pub fn write_into_file(&self) -> bool

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

Source

pub fn file_write_period_ms(&self) -> u32

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

Source

pub fn max_file_size_bytes(&self) -> u64

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

Source

pub fn deferred_start(&self) -> bool

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

Source

pub fn flush_period_ms(&self) -> u32

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

Source

pub fn flush_timeout_ms(&self) -> u32

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

Source

pub fn notify_traceur(&self) -> bool

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

Source

pub fn allow_user_build_tracing(&self) -> bool

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

Source

pub fn unique_session_name(&self) -> &str

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

Source

pub fn data_source_stop_timeout_ms(&self) -> u32

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

Source

pub fn compression_type(&self) -> CompressionType

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

Source

pub fn set_compression_type(&mut self, value: CompressionType)

Sets compression_type to the provided enum value.

Source

pub fn trace_uuid_msb(&self) -> i64

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

Source

pub fn trace_uuid_lsb(&self) -> i64

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

Source

pub fn output_path(&self) -> &str

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

Source

pub fn bugreport_score(&self) -> i32

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

Source

pub fn statsd_logging(&self) -> StatsdLogging

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

Source

pub fn set_statsd_logging(&mut self, value: StatsdLogging)

Sets statsd_logging to the provided enum value.

Source

pub fn prefer_suspend_clock_for_duration(&self) -> bool

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

Source

pub fn bugreport_filename(&self) -> &str

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

Trait Implementations§

Source§

impl Clone for TraceConfig

Source§

fn clone(&self) -> TraceConfig

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 TraceConfig

Source§

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

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

impl Default for TraceConfig

Source§

fn default() -> Self

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

impl Message for TraceConfig

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 TraceConfig

Source§

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

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 u8)

🔬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.