/ src / util / trace.h
trace.h
 1  // Copyright (c) 2020-2021 The Bitcoin Core developers
 2  // Distributed under the MIT software license, see the accompanying
 3  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 4  
 5  #ifndef BITCOIN_UTIL_TRACE_H
 6  #define BITCOIN_UTIL_TRACE_H
 7  
 8  #if defined(HAVE_CONFIG_H)
 9  #include <config/bitcoin-config.h>
10  #endif
11  
12  #ifdef ENABLE_TRACING
13  
14  #include <sys/sdt.h>
15  
16  #define TRACE(context, event) DTRACE_PROBE(context, event)
17  #define TRACE1(context, event, a) DTRACE_PROBE1(context, event, a)
18  #define TRACE2(context, event, a, b) DTRACE_PROBE2(context, event, a, b)
19  #define TRACE3(context, event, a, b, c) DTRACE_PROBE3(context, event, a, b, c)
20  #define TRACE4(context, event, a, b, c, d) DTRACE_PROBE4(context, event, a, b, c, d)
21  #define TRACE5(context, event, a, b, c, d, e) DTRACE_PROBE5(context, event, a, b, c, d, e)
22  #define TRACE6(context, event, a, b, c, d, e, f) DTRACE_PROBE6(context, event, a, b, c, d, e, f)
23  #define TRACE7(context, event, a, b, c, d, e, f, g) DTRACE_PROBE7(context, event, a, b, c, d, e, f, g)
24  #define TRACE8(context, event, a, b, c, d, e, f, g, h) DTRACE_PROBE8(context, event, a, b, c, d, e, f, g, h)
25  #define TRACE9(context, event, a, b, c, d, e, f, g, h, i) DTRACE_PROBE9(context, event, a, b, c, d, e, f, g, h, i)
26  #define TRACE10(context, event, a, b, c, d, e, f, g, h, i, j) DTRACE_PROBE10(context, event, a, b, c, d, e, f, g, h, i, j)
27  #define TRACE11(context, event, a, b, c, d, e, f, g, h, i, j, k) DTRACE_PROBE11(context, event, a, b, c, d, e, f, g, h, i, j, k)
28  #define TRACE12(context, event, a, b, c, d, e, f, g, h, i, j, k, l) DTRACE_PROBE12(context, event, a, b, c, d, e, f, g, h, i, j, k, l)
29  
30  #else
31  
32  #define TRACE(context, event)
33  #define TRACE1(context, event, a)
34  #define TRACE2(context, event, a, b)
35  #define TRACE3(context, event, a, b, c)
36  #define TRACE4(context, event, a, b, c, d)
37  #define TRACE5(context, event, a, b, c, d, e)
38  #define TRACE6(context, event, a, b, c, d, e, f)
39  #define TRACE7(context, event, a, b, c, d, e, f, g)
40  #define TRACE8(context, event, a, b, c, d, e, f, g, h)
41  #define TRACE9(context, event, a, b, c, d, e, f, g, h, i)
42  #define TRACE10(context, event, a, b, c, d, e, f, g, h, i, j)
43  #define TRACE11(context, event, a, b, c, d, e, f, g, h, i, j, k)
44  #define TRACE12(context, event, a, b, c, d, e, f, g, h, i, j, k, l)
45  
46  #endif
47  
48  
49  #endif // BITCOIN_UTIL_TRACE_H