1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
use crate::*;
pub use firestorm_core::{EventData, Start};

pub struct SpanGuard;

impl Drop for SpanGuard {
    #[inline(always)]
    fn drop(&mut self) {
        crate::end();
    }
}

pub fn start(data: EventData) {
    with_events(|events| {
        let event = Event {
            time: TimeSample::now(),
            data,
        };
        events.push(event);
    });
}