fuchsia_trace

Macro async_enter

Source
macro_rules! async_enter {
    ($id:expr, $category:expr, $name:expr $(, $key:expr => $val:expr)*) => { ... };
}
Expand description

Convenience macro for the async_enter function, which can be used to trace the duration of a scope containing async code. This macro returns the drop guard, which the caller may then choose to manage.

Example:

{
    let id = Id::new();
    let _guard = async_enter!(id, c"foo", c"bar", "x" => 5, "y" => 10);
    ...
    ...
    // event recorded on drop
}

is equivalent to

{
    let id = Id::new();
    let _guard = AsyncScope::begin(id, c"foo", c"bar", &[ArgValue::of("x", 5),
        ArgValue::of("y", 10)]);
    ...
    ...
    // event recorded on drop
}

Calls to async_enter! may be nested.