micromegas_tracing/spans/
span_events.rs

1use crate::string_id::StringId;
2use micromegas_transit::prelude::*;
3
4use super::{SpanLocation, SpanMetadata};
5
6// SpanLocationRecord is the serialized version of SpanLocation
7#[derive(Debug, TransitReflect)]
8pub struct SpanLocationRecord {
9    pub id: u64,
10    pub target: *const u8,
11    pub module_path: *const u8,
12    pub file: *const u8,
13    pub line: u32,
14    pub lod: u32,
15}
16
17impl InProcSerialize for SpanLocationRecord {}
18
19// SpanRecord is the serialized version of SpanMetadata
20#[derive(Debug, TransitReflect)]
21pub struct SpanRecord {
22    pub id: u64,
23    pub name: *const u8,
24    pub target: *const u8,
25    pub module_path: *const u8,
26    pub file: *const u8,
27    pub line: u32,
28    pub lod: u32,
29}
30
31impl InProcSerialize for SpanRecord {}
32
33//
34// sync events
35//
36#[derive(Debug, TransitReflect)]
37pub struct BeginThreadSpanEvent {
38    pub thread_span_desc: &'static SpanMetadata,
39    pub time: i64,
40}
41
42impl InProcSerialize for BeginThreadSpanEvent {}
43
44#[derive(Debug, TransitReflect)]
45pub struct EndThreadSpanEvent {
46    pub thread_span_desc: &'static SpanMetadata,
47    pub time: i64,
48}
49
50impl InProcSerialize for EndThreadSpanEvent {}
51#[derive(Debug, TransitReflect)]
52pub struct BeginThreadNamedSpanEvent {
53    pub thread_span_location: &'static SpanLocation,
54    pub name: StringId,
55    pub time: i64,
56}
57
58impl InProcSerialize for BeginThreadNamedSpanEvent {}
59
60#[derive(Debug, TransitReflect)]
61pub struct EndThreadNamedSpanEvent {
62    pub thread_span_location: &'static SpanLocation,
63    pub name: StringId,
64    pub time: i64,
65}
66
67impl InProcSerialize for EndThreadNamedSpanEvent {}
68
69//
70// async events
71//
72#[derive(Debug, TransitReflect)]
73pub struct BeginAsyncSpanEvent {
74    pub span_desc: &'static SpanMetadata,
75    pub span_id: u64,
76    pub parent_span_id: u64, // parent span at future creation time
77    pub depth: u32,          // nesting depth in async call hierarchy
78    pub time: i64,
79}
80
81impl InProcSerialize for BeginAsyncSpanEvent {}
82
83#[derive(Debug, TransitReflect)]
84pub struct EndAsyncSpanEvent {
85    pub span_desc: &'static SpanMetadata,
86    pub span_id: u64,
87    pub parent_span_id: u64, // parent span at future creation time
88    pub depth: u32,          // nesting depth in async call hierarchy
89    pub time: i64,
90}
91
92impl InProcSerialize for EndAsyncSpanEvent {}
93#[derive(Debug, TransitReflect)]
94pub struct BeginAsyncNamedSpanEvent {
95    pub span_location: &'static SpanLocation,
96    pub name: StringId,
97    pub span_id: u64,
98    pub parent_span_id: u64, // parent span at future creation time
99    pub depth: u32,          // nesting depth in async call hierarchy
100    pub time: i64,
101}
102
103impl InProcSerialize for BeginAsyncNamedSpanEvent {}
104
105#[derive(Debug, TransitReflect)]
106pub struct EndAsyncNamedSpanEvent {
107    pub span_location: &'static SpanLocation,
108    pub name: StringId,
109    pub span_id: u64,
110    pub parent_span_id: u64, // parent span at future creation time
111    pub depth: u32,          // nesting depth in async call hierarchy
112    pub time: i64,
113}
114
115impl InProcSerialize for EndAsyncNamedSpanEvent {}