pub struct TracePacket {Show 13 fields
pub timestamp: Option<u64>,
pub timestamp_clock_id: Option<u32>,
pub trusted_pid: Option<i32>,
pub interned_data: Option<InternedData>,
pub sequence_flags: Option<u32>,
pub incremental_state_cleared: Option<bool>,
pub trace_packet_defaults: Option<TracePacketDefaults>,
pub previous_packet_dropped: Option<bool>,
pub first_packet_on_sequence: Option<bool>,
pub machine_id: Option<u32>,
pub data: Option<Data>,
pub optional_trusted_uid: Option<OptionalTrustedUid>,
pub optional_trusted_packet_sequence_id: Option<OptionalTrustedPacketSequenceId>,
}
Expand description
TracePacket is the root object of a Perfetto trace. A Perfetto trace is a linear sequence of TracePacket(s).
The tracing service guarantees that all TracePacket(s) written by a given TraceWriter are seen in-order, without gaps or duplicates. If, for any reason, a TraceWriter sequence becomes invalid, no more packets are returned to the Consumer (or written into the trace file). TracePacket(s) written by different TraceWriter(s), hence even different data sources, can be seen in arbitrary order. The consumer can re-establish a total order, if interested, using the packet timestamps, after having synchronized the different clocks onto a global clock.
The tracing service is agnostic of the content of TracePacket, with the exception of few fields (e.g.. trusted_*, trace_config) that are written by the service itself.
See the Buffers and Dataflow doc for details.
Next reserved id: 14 (up to 15). Next id: 113.
Fields§
§timestamp: Option<u64>
The timestamp of the TracePacket. By default this timestamps refers to the trace clock (CLOCK_BOOTTIME on Android). It can be overridden using a different timestamp_clock_id. The clock domain definition in ClockSnapshot can also override:
- The unit (default: 1ns).
- The absolute vs delta encoding (default: absolute timestamp).
timestamp_clock_id: Option<u32>
Specifies the ID of the clock used for the TracePacket |timestamp|. Can be one of the built-in types from ClockSnapshot::BuiltinClocks, or a producer-defined clock id. If unspecified and if no default per-sequence value has been provided via TracePacketDefaults, it defaults to BuiltinClocks::BOOTTIME.
trusted_pid: Option<i32>
Trusted process id of the producer which generated this packet, written by the service.
interned_data: Option<InternedData>
Incrementally emitted interned data, valid only on the packet’s sequence (packets with the same |trusted_packet_sequence_id|). The writer will usually emit new interned data in the same TracePacket that first refers to it (since the last reset of interning state). It may also be emitted proactively in advance of referring to them in later packets.
sequence_flags: Option<u32>
§incremental_state_cleared: Option<bool>
DEPRECATED. Moved to SequenceFlags::SEQ_INCREMENTAL_STATE_CLEARED.
trace_packet_defaults: Option<TracePacketDefaults>
Default values for fields of later TracePackets emitted on this packet’s sequence (TracePackets with the same |trusted_packet_sequence_id|). It must be reemitted when incremental state is cleared (see |incremental_state_cleared|). Requires that any future packet emitted on the same sequence specifies the SEQ_NEEDS_INCREMENTAL_STATE flag. TracePacketDefaults always override the global defaults for any future packet on this sequence (regardless of SEQ_NEEDS_INCREMENTAL_STATE).
previous_packet_dropped: Option<bool>
Flag set by the service if, for the current packet sequence (see |trusted_packet_sequence_id|), either:
- this is the first packet, or
- one or multiple packets were dropped since the last packet that the consumer read from the sequence. This can happen if chunks in the trace buffer are overridden before the consumer could read them when the trace is configured in ring buffer mode.
When packet loss occurs, incrementally emitted data (including interned data) on the sequence should be considered invalid up until the next packet with SEQ_INCREMENTAL_STATE_CLEARED set.
first_packet_on_sequence: Option<bool>
Flag set by a producer (starting from SDK v29) if, for the current packet sequence (see |trusted_packet_sequence_id|), this is the first packet.
This flag can be used for distinguishing the two situations when processing the trace:
- There are no prior events for the sequence because of data loss, e.g. due to ring buffer wrapping.
- There are no prior events for the sequence because it didn’t start before this packet (= there’s definitely no preceding data loss).
Given that older SDK versions do not support this flag, this flag not being present for a particular sequence does not necessarily imply data loss.
machine_id: Option<u32>
The machine ID for identifying trace packets in a multi-machine tracing session. Is emitted by the tracing service for producers running on a remote host (e.g. a VM guest). For more context: go/crosetto-vm-tracing.
data: Option<Data>
§optional_trusted_uid: Option<OptionalTrustedUid>
Trusted user id of the producer which generated this packet. Keep in sync with TrustedPacket.trusted_uid.
TODO(eseckler): Emit this field in a PacketSequenceDescriptor message instead.
optional_trusted_packet_sequence_id: Option<OptionalTrustedPacketSequenceId>
Service-assigned identifier of the packet sequence this packet belongs to. Uniquely identifies a producer + writer pair within the tracing session. A value of zero denotes an invalid ID. Keep in sync with TrustedPacket.trusted_packet_sequence_id.
Implementations§
Source§impl TracePacket
impl TracePacket
Sourcepub fn timestamp(&self) -> u64
pub fn timestamp(&self) -> u64
Returns the value of timestamp
, or the default value if timestamp
is unset.
Sourcepub fn sequence_flags(&self) -> u32
pub fn sequence_flags(&self) -> u32
Returns the value of sequence_flags
, or the default value if sequence_flags
is unset.
Sourcepub fn incremental_state_cleared(&self) -> bool
pub fn incremental_state_cleared(&self) -> bool
Returns the value of incremental_state_cleared
, or the default value if incremental_state_cleared
is unset.
Sourcepub fn previous_packet_dropped(&self) -> bool
pub fn previous_packet_dropped(&self) -> bool
Returns the value of previous_packet_dropped
, or the default value if previous_packet_dropped
is unset.
Sourcepub fn timestamp_clock_id(&self) -> u32
pub fn timestamp_clock_id(&self) -> u32
Returns the value of timestamp_clock_id
, or the default value if timestamp_clock_id
is unset.
Sourcepub fn trusted_pid(&self) -> i32
pub fn trusted_pid(&self) -> i32
Returns the value of trusted_pid
, or the default value if trusted_pid
is unset.
Sourcepub fn first_packet_on_sequence(&self) -> bool
pub fn first_packet_on_sequence(&self) -> bool
Returns the value of first_packet_on_sequence
, or the default value if first_packet_on_sequence
is unset.
Sourcepub fn machine_id(&self) -> u32
pub fn machine_id(&self) -> u32
Returns the value of machine_id
, or the default value if machine_id
is unset.
Trait Implementations§
Source§impl Clone for TracePacket
impl Clone for TracePacket
Source§fn clone(&self) -> TracePacket
fn clone(&self) -> TracePacket
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TracePacket
impl Debug for TracePacket
Source§impl Default for TracePacket
impl Default for TracePacket
Source§impl Message for TracePacket
impl Message for TracePacket
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
Source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
Source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
.