pub struct Sample {
pub name: StrCow,
pub categories: Option<CategoriesT>,
pub timestamp_us: u64,
pub event_type: SampleEventType,
pub duration_us: Option<u64>,
pub pid: u64,
pub tid: u64,
pub thread_name: Option<StrCow>,
pub args: Option<SampleArgs>,
}Expand description
Stores the relevant data about a sample for later serialization.
The payload associated with any sample is by default a string but may be
configured via the json_payload feature (there is an
associated performance hit across the board for turning it on).
Fields§
§name: StrCowThe name of the event to be shown.
categories: Option<CategoriesT>List of categories the event applies to.
timestamp_us: u64When was the sample started.
event_type: SampleEventTypeWhat kind of sample this is.
duration_us: Option<u64>§pid: u64The process the sample was captured in.
tid: u64The thread the sample was captured on. Omitted for Metadata events that want to set the process name (if provided then sets the thread name).
thread_name: Option<StrCow>§args: Option<SampleArgs>Implementations§
Source§impl Sample
impl Sample
Sourcepub fn new_duration_marker<S, C>(
name: S,
categories: C,
payload: Option<TracePayloadT>,
event_type: SampleEventType,
) -> Self
pub fn new_duration_marker<S, C>( name: S, categories: C, payload: Option<TracePayloadT>, event_type: SampleEventType, ) -> Self
Constructs a Begin or End sample. Should not be used directly. Instead should be constructed via SampleGuard.
Sourcepub fn new_duration<S, C>(
name: S,
categories: C,
payload: Option<TracePayloadT>,
start_ns: u64,
duration_ns: u64,
) -> Self
pub fn new_duration<S, C>( name: S, categories: C, payload: Option<TracePayloadT>, start_ns: u64, duration_ns: u64, ) -> Self
Constructs a Duration sample. For use via xi_trace::closure.
Sourcepub fn new_instant<S, C>(
name: S,
categories: C,
payload: Option<TracePayloadT>,
) -> Self
pub fn new_instant<S, C>( name: S, categories: C, payload: Option<TracePayloadT>, ) -> Self
Constructs an instantaneous sample.