tracing_perfetto_sdk_schema

Struct TrackEvent

Source
pub struct TrackEvent {
Show 37 fields pub category_iids: Vec<u64>, pub categories: Vec<String>, pub type: Option<i32>, pub track_uuid: Option<u64>, pub extra_counter_track_uuids: Vec<u64>, pub extra_counter_values: Vec<i64>, pub extra_double_counter_track_uuids: Vec<u64>, pub extra_double_counter_values: Vec<f64>, pub flow_ids_old: Vec<u64>, pub flow_ids: Vec<u64>, pub terminating_flow_ids_old: Vec<u64>, pub terminating_flow_ids: Vec<u64>, pub debug_annotations: Vec<DebugAnnotation>, pub task_execution: Option<TaskExecution>, pub log_message: Option<LogMessage>, pub cc_scheduler_state: Option<ChromeCompositorSchedulerState>, pub chrome_user_event: Option<ChromeUserEvent>, pub chrome_keyed_service: Option<ChromeKeyedService>, pub chrome_legacy_ipc: Option<ChromeLegacyIpc>, pub chrome_histogram_sample: Option<ChromeHistogramSample>, pub chrome_latency_info: Option<ChromeLatencyInfo>, pub chrome_frame_reporter: Option<ChromeFrameReporter>, pub chrome_application_state_info: Option<ChromeApplicationStateInfo>, pub chrome_renderer_scheduler_state: Option<ChromeRendererSchedulerState>, pub chrome_window_handle_event_info: Option<ChromeWindowHandleEventInfo>, pub chrome_content_settings_event_info: Option<ChromeContentSettingsEventInfo>, pub chrome_active_processes: Option<ChromeActiveProcesses>, pub screenshot: Option<Screenshot>, pub chrome_message_pump: Option<ChromeMessagePump>, pub chrome_mojo_event_info: Option<ChromeMojoEventInfo>, pub legacy_event: Option<LegacyEvent>, pub name_field: Option<NameField>, pub counter_value_field: Option<CounterValueField>, pub source_location_field: Option<SourceLocationField>, pub timestamp: Option<Timestamp>, pub thread_time: Option<ThreadTime>, pub thread_instruction_count: Option<ThreadInstructionCount>,
}
Expand description

Trace events emitted by client instrumentation library (TRACE_EVENT macros), which describe activity on a track, such as a thread or asynchronous event track. The track is specified using separate TrackDescriptor messages and referred to via the track’s UUID.

A simple TrackEvent packet specifies a timestamp, category, name and type:

   trace_packet {
     timestamp: 1000
     track_event {
       categories: \["my_cat"\]
       name: "my_event"
       type: TYPE_INSTANT
      }
    }

To associate an event with a custom track (e.g. a thread), the track is defined in a separate packet and referred to from the TrackEvent by its UUID:

   trace_packet {
     track_descriptor {
       track_uuid: 1234
       name: "my_track"

       // Optionally, associate the track with a thread.
       thread_descriptor {
         pid: 10
         tid: 10
         ..
       }
     }
   }

A pair of TYPE_SLICE_BEGIN and _END events form a slice on the track:

   trace_packet {
     timestamp: 1200
     track_event {
       track_uuid: 1234
       categories: \["my_cat"\]
       name: "my_slice"
       type: TYPE_SLICE_BEGIN
     }
   }
   trace_packet {
     timestamp: 1400
     track_event {
       track_uuid: 1234
       type: TYPE_SLICE_END
     }
   }

TrackEvents also support optimizations to reduce data repetition and encoded data size, e.g. through data interning (names, categories, …) and delta encoding of timestamps/counters. For details, see the InternedData message. Further, default values for attributes of events on the same sequence (e.g. their default track association) can be emitted as part of a TrackEventDefaults message.

Next reserved id: 13 (up to 15). Next id: 52.

Fields§

§category_iids: Vec<u64>

Names of categories of the event. In the client library, categories are a way to turn groups of individual events on or off. interned EventCategoryName.

§categories: Vec<String>

non-interned variant.

§type: Option<i32>§track_uuid: Option<u64>

Identifies the track of the event. The default value may be overridden using TrackEventDefaults, e.g., to specify the track of the TraceWriter’s sequence (in most cases sequence = one thread). If no value is specified here or in TrackEventDefaults, the TrackEvent will be associated with an implicit trace-global track (uuid 0). See TrackDescriptor::uuid.

§extra_counter_track_uuids: Vec<u64>

To encode counter values more efficiently, we support attaching additional counter values to a TrackEvent of any type. All values will share the same timestamp specified in the TracePacket. The value at extra_counter_values[N] is for the counter track referenced by extra_counter_track_uuids[N].

|extra_counter_track_uuids| may also be set via TrackEventDefaults. There should always be equal or more uuids than values. It is valid to set more uuids (e.g. via defaults) than values. If uuids are specified in TrackEventDefaults and a TrackEvent, the TrackEvent uuids override the default uuid list.

For example, this allows snapshotting the thread time clock at each thread-track BEGIN and END event to capture the cpu time delta of a slice.

§extra_counter_values: Vec<i64>§extra_double_counter_track_uuids: Vec<u64>

Counter snapshots using floating point instead of integer values.

§extra_double_counter_values: Vec<f64>§flow_ids_old: Vec<u64>
👎Deprecated

IDs of flows originating, passing through, or ending at this event. Flow IDs are global within a trace.

A flow connects a sequence of TrackEvents within or across tracks, e.g. an input event may be handled on one thread but cause another event on a different thread - a flow between the two events can associate them.

The direction of the flows between events is inferred from the events’ timestamps. The earliest event with the same flow ID becomes the source of the flow. Any events thereafter are intermediate steps of the flow, until the flow terminates at the last event with the flow ID.

Flows can also be explicitly terminated (see |terminating_flow_ids|), so that the same ID can later be reused for another flow. DEPRECATED. Only kept for backwards compatibility. Use |flow_ids|.

§flow_ids: Vec<u64>

TODO(b/204341740): replace “flow_ids_old” with “flow_ids” to reduce memory consumption.

§terminating_flow_ids_old: Vec<u64>
👎Deprecated

List of flow ids which should terminate on this event, otherwise same as |flow_ids|. Any one flow ID should be either listed as part of |flow_ids| OR |terminating_flow_ids|, not both. DEPRECATED. Only kept for backwards compatibility. Use |terminating_flow_ids|.

§terminating_flow_ids: Vec<u64>

TODO(b/204341740): replace “terminating_flow_ids_old” with “terminating_flow_ids” to reduce memory consumption.

§debug_annotations: Vec<DebugAnnotation>

Unstable key/value annotations shown in the trace viewer but not intended for metrics use.

§task_execution: Option<TaskExecution>

Typed event arguments:

§log_message: Option<LogMessage>§cc_scheduler_state: Option<ChromeCompositorSchedulerState>§chrome_user_event: Option<ChromeUserEvent>§chrome_keyed_service: Option<ChromeKeyedService>§chrome_legacy_ipc: Option<ChromeLegacyIpc>§chrome_histogram_sample: Option<ChromeHistogramSample>§chrome_latency_info: Option<ChromeLatencyInfo>§chrome_frame_reporter: Option<ChromeFrameReporter>§chrome_application_state_info: Option<ChromeApplicationStateInfo>§chrome_renderer_scheduler_state: Option<ChromeRendererSchedulerState>§chrome_window_handle_event_info: Option<ChromeWindowHandleEventInfo>§chrome_content_settings_event_info: Option<ChromeContentSettingsEventInfo>§chrome_active_processes: Option<ChromeActiveProcesses>§screenshot: Option<Screenshot>§chrome_message_pump: Option<ChromeMessagePump>§chrome_mojo_event_info: Option<ChromeMojoEventInfo>§legacy_event: Option<LegacyEvent>§name_field: Option<NameField>

Optional name of the event for its display in trace viewer. May be left unspecified for events with typed arguments.

Note that metrics should not rely on event names, as they are prone to changing. Instead, they should use typed arguments to identify the events they are interested in.

§counter_value_field: Option<CounterValueField>

A new value for a counter track. |track_uuid| should refer to a track with a CounterDescriptor, and |type| should be TYPE_COUNTER. For a more efficient encoding of counter values that are sampled at the beginning/end of a slice, see |extra_counter_values| and |extra_counter_track_uuids|. Counter values can optionally be encoded in as delta values (positive or negative) on each packet sequence (see CounterIncrementalBase).

§source_location_field: Option<SourceLocationField>

This field is used only if the source location represents the function that executes during this event.

§timestamp: Option<Timestamp>

Deprecated. Use the |timestamp| and |timestamp_clock_id| fields in TracePacket instead.

Timestamp in microseconds (usually CLOCK_MONOTONIC).

§thread_time: Option<ThreadTime>

Deprecated. Use |extra_counter_values| and |extra_counter_track_uuids| to encode thread time instead.

CPU time for the current thread (e.g., CLOCK_THREAD_CPUTIME_ID) in microseconds.

§thread_instruction_count: Option<ThreadInstructionCount>

Deprecated. Use |extra_counter_values| and |extra_counter_track_uuids| to encode thread instruction count instead.

Value of the instruction counter for the current thread.

Implementations§

Source§

impl TrackEvent

Source

pub fn type(&self) -> Type

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

Source

pub fn set_type(&mut self, value: Type)

Sets type to the provided enum value.

Source

pub fn track_uuid(&self) -> u64

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

Trait Implementations§

Source§

impl Clone for TrackEvent

Source§

fn clone(&self) -> TrackEvent

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 TrackEvent

Source§

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

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

impl Default for TrackEvent

Source§

fn default() -> Self

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

impl Message for TrackEvent

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 TrackEvent

Source§

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

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.