pub struct StackSample {
pub primary_weight: Option<u64>,
pub follower_descriptors: Vec<CounterDescriptor>,
pub follower_descriptor_iids: Vec<u64>,
pub follower_weights: Vec<u64>,
pub task_context_field: Option<TaskContextField>,
pub execution_context_field: Option<ExecutionContextField>,
pub callstack_field: Option<CallstackField>,
pub unwind_error_field: Option<UnwindErrorField>,
pub primary_descriptor_field: Option<PrimaryDescriptorField>,
}Expand description
A single stack sample: a callstack captured for a task, measured against a counter timebase. This is transport-neutral and timebase-neutral. The timebase can be CPU cycles, wall-clock nanoseconds, allocated bytes, page faults, etc.; the primary CounterDescriptor says which. It is not specific to CPU profiling.
Each context/callstack/descriptor can be given inline or as an iid
referencing an InternedData entry. Producers that reuse a context across
samples should intern it so the per-sample cost is a single varint.
Fields§
§primary_weight: Option<u64>The value attributed to this sample for the primary counter (e.g. the number of cycles or nanoseconds this sample represents).
follower_descriptors: Vec<CounterDescriptor>Additional counters read at the same sample (e.g. instructions, cache misses read alongside a cycles timebase). follower_weights is positional with whichever of follower_descriptors / follower_descriptor_iids is set.
follower_descriptor_iids: Vec<u64>§follower_weights: Vec<u64>§task_context_field: Option<TaskContextField>The task (thread / process / async context) this sample is attributed to.
Give it inline via task_context or reference an interned TaskContext via
task_context_iid.
execution_context_field: Option<ExecutionContextField>The execution state (cpu, privilege mode) at sample time. Absent for
samplers that observe off-CPU tasks. Give it inline via execution_context
or reference an interned ExecutionContext via execution_context_iid.
callstack_field: Option<CallstackField>The captured callstack, bottom frame first. Give it fully inline via
callstack or reference an interned Callstack via callstack_iid.
unwind_error_field: Option<UnwindErrorField>Set if stack unwinding was incomplete; describes the data, not producer
internal state. Give it inline via unwind_error or reference an interned
string via unwind_error_iid.
TODO(lalitm): not yet parsed by trace_processor. Defined now to lock the wire layout; a table column will surface it later.
primary_descriptor_field: Option<PrimaryDescriptorField>The sampling timebase: the counter this sample’s weight is measured against. Set one of the two; may be omitted entirely if declared in StackSampleDefaults.primary_descriptor.
Implementations§
Source§impl StackSample
impl StackSample
Sourcepub fn primary_weight(&self) -> u64
pub fn primary_weight(&self) -> u64
Returns the value of primary_weight, or the default value if primary_weight is unset.
Trait Implementations§
Source§impl Clone for StackSample
impl Clone for StackSample
Source§fn clone(&self) -> StackSample
fn clone(&self) -> StackSample
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StackSample
impl Debug for StackSample
Source§impl Default for StackSample
impl Default for StackSample
Source§impl Message for StackSample
impl Message for StackSample
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
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(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
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(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for StackSample
impl PartialEq for StackSample
Source§fn eq(&self, other: &StackSample) -> bool
fn eq(&self, other: &StackSample) -> bool
self and other values to be equal, and is used by ==.