aboutsummaryrefslogtreecommitdiff
path: root/src/lib/trace/usdt/usdt.h
blob: 0b5fd6c4441ea3c9350d4dc5ac62ee6c5563a6ac (plain)
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
/* Copyright (c) 2020, The Tor Project, Inc. */
/* See LICENSE for licensing information */

/**
 * \file trace.h
 * \brief Header for usdt.h
 **/

#ifndef TOR_TRACE_USDT_USDT_H
#define TOR_TRACE_USDT_USDT_H

#ifdef USE_TRACING_INSTRUMENTATION_USDT

#ifdef HAVE_SYS_SDT_H
#define SDT_USE_VARIADIC
#include <sys/sdt.h>
#define TOR_STAP_PROBEV STAP_PROBEV
#else /* defined(HAVE_SYS_SDT_H) */
#define TOR_STAP_PROBEV(...)
#endif

/* Map events to an USDT probe. */
#define TOR_TRACE_USDT(subsystem, event_name, ...) \
  TOR_STAP_PROBEV(subsystem, event_name, ## __VA_ARGS__);

#else /* !defined(USE_TRACING_INSTRUMENTATION_USDT) */

/* NOP event. */
#define TOR_TRACE_USDT(subsystem, event_name, ...)

#endif /* !defined(USE_TRACING_INSTRUMENTATION_USDT) */

#endif /* !defined(TOR_TRACE_USDT_USDT_H) */