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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#[macro_export]
macro_rules! trace_duration {
    ($name:expr $(, $key:expr => $val:expr)*) => {
        #[cfg(feature = "tracing")]
        ::fuchsia_trace::duration!("fxfs", $name $(,$key => $val)*);
    }
}

#[macro_export]
macro_rules! trace_instant {
    ($name:expr, $scope:expr $(, $key:expr => $val:expr)*) => {
        #[cfg(feature = "tracing")]
        ::fuchsia_trace::instant!("fxfs", $name, $scope $(,$key => $val)*);
    }
}

#[macro_export]
macro_rules! trace_flow_begin {
    ($name:expr, $flow_id:expr $(, $key:expr => $val:expr)*) => {
        #[cfg(feature = "tracing")]
        ::fuchsia_trace::flow_begin!("fxfs", $name, $flow_id $(,$key => $val)*);
    }
}

#[macro_export]
macro_rules! trace_flow_step {
    ($name:expr, $flow_id:expr $(, $key:expr => $val:expr)*) => {
        #[cfg(feature = "tracing")]
        ::fuchsia_trace::flow_step!("fxfs", $name, $flow_id $(,$key => $val)*);
    }
}

#[macro_export]
macro_rules! trace_flow_end {
    ($name:expr, $flow_id:expr $(, $key:expr => $val:expr)*) => {
        #[cfg(feature = "tracing")]
        ::fuchsia_trace::flow_end!("fxfs", $name, $flow_id $(,$key => $val)*);
    }
}

#[macro_export]
macro_rules! async_enter {
    ($name:expr $(, $key:expr => $val:expr)*) => {
        #[cfg(feature = "tracing")]
        let _async_enter_guard = ::fuchsia_trace::async_enter!(
            ::fuchsia_trace::Id::new(), "fxfs", $name $(, $key => $val)*);
    }
}