Tor  0.4.7.0-alpha-dev
usdt.h
1 /* Copyright (c) 2020, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 /**
5  * \file trace.h
6  * \brief Header for usdt.h
7  **/
8 
9 #ifndef TOR_TRACE_USDT_USDT_H
10 #define TOR_TRACE_USDT_USDT_H
11 
12 #ifdef USE_TRACING_INSTRUMENTATION_USDT
13 
14 #ifdef HAVE_SYS_SDT_H
15 #define SDT_USE_VARIADIC
16 #include <sys/sdt.h>
17 #define TOR_STAP_PROBEV STAP_PROBEV
18 #else /* defined(HAVE_SYS_SDT_H) */
19 #define TOR_STAP_PROBEV(...)
20 #endif
21 
22 /* Map events to an USDT probe. */
23 #define TOR_TRACE_USDT(subsystem, event_name, ...) \
24  TOR_STAP_PROBEV(subsystem, event_name, ## __VA_ARGS__);
25 
26 #else /* !defined(USE_TRACING_INSTRUMENTATION_USDT) */
27 
28 /* NOP event. */
29 #define TOR_TRACE_USDT(subsystem, event_name, ...)
30 
31 #endif /* !defined(USE_TRACING_INSTRUMENTATION_USDT) */
32 
33 #endif /* !defined(TOR_TRACE_USDT_USDT_H) */