pub struct Clock {
pub clock_id: Option<u32>,
pub timestamp: Option<u64>,
pub is_incremental: Option<bool>,
pub unit_multiplier_ns: Option<u64>,
}
Fields§
§clock_id: Option<u32>
Clock IDs have the following semantic: [1, 63]: Builtin types, see BuiltinClock from ../common/builtin_clock.proto. [64, 127]: User-defined clocks. These clocks are sequence-scoped. They are only valid within the same |trusted_packet_sequence_id| (i.e. only for TracePacket(s) emitted by the same TraceWriter that emitted the clock snapshot). [128, MAX]: Reserved for future use. The idea is to allow global clock IDs and setting this ID to hash(full_clock_name) & ~127.
timestamp: Option<u64>
Absolute timestamp. Unit is ns unless specified otherwise by the unit_multiplier_ns field below.
is_incremental: Option<bool>
When true each TracePacket’s timestamp should be interpreted as a delta from the last TracePacket’s timestamp (referencing this clock) emitted by the same packet_sequence_id. Should only be used for user-defined sequence-local clocks. The first packet timestamp after each ClockSnapshot that contains this clock is relative to the |timestamp| in the ClockSnapshot.
unit_multiplier_ns: Option<u64>
Allows to specify a custom unit different than the default (ns) for this clock domain. A multiplier of 1000 means that a timestamp = 3 should be interpreted as 3000 ns = 3 us. All snapshots for the same clock within a trace need to use the same unit.
Implementations§
Source§impl Clock
impl Clock
Sourcepub fn clock_id(&self) -> u32
pub fn clock_id(&self) -> u32
Returns the value of clock_id
, or the default value if clock_id
is unset.
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 is_incremental(&self) -> bool
pub fn is_incremental(&self) -> bool
Returns the value of is_incremental
, or the default value if is_incremental
is unset.
Sourcepub fn unit_multiplier_ns(&self) -> u64
pub fn unit_multiplier_ns(&self) -> u64
Returns the value of unit_multiplier_ns
, or the default value if unit_multiplier_ns
is unset.
Trait Implementations§
Source§impl Message for Clock
impl Message for Clock
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
.