1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#[macro_export]
macro_rules! scope {
    ($name:expr) => {
        #[cfg(feature = "profile-with-puffin")]
        puffin::profile_scope!($name);

        #[cfg(feature = "profile-with-optick")]
        optick::event!($name);

        #[cfg(feature = "profile-with-tracing")]
        tracing::span!(tracing::Level::INFO, $name).enter();
    };

    ($name:expr, $data:expr) => {
        #[cfg(feature = "profile-with-puffin")]
        puffin::profile_scope_data!($data);

        #[cfg(feature = "profile-with-optick")]
        optick::event!($name);
        #[cfg(feature = "profile-with-optick")]
        optick::tag!($data);

        #[cfg(feature = "profile-with-tracing")]
        tracing::span!(tracing::Level::INFO, $name, tag = $data).enter();
    };
}