2 * Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
4 * SPDX-License-Identifier: GPL-2.0-only
10 #define testpoint(name)
11 #define TESTPOINT_DECL(name)
13 #else /* NTESTPOINT */
15 #include <urcu.h> /* for caa_likely/unlikely */
17 extern int lttng_testpoint_activated
;
19 void *lttng_testpoint_lookup(const char *name
);
22 * Testpoint is only active if the global lttng_testpoint_activated flag is
24 * Return a non-zero error code to indicate failure.
26 #define testpoint(name) \
27 ((caa_unlikely(lttng_testpoint_activated)) \
28 ? __testpoint_##name##_wrapper() : 0)
31 * One wrapper per testpoint is generated. This is to keep track of the symbol
32 * lookup status and the corresponding function pointer, if any.
34 #define _TESTPOINT_DECL(_name) \
35 static inline int __testpoint_##_name##_wrapper(void) \
38 static int (*tp)(void); \
40 const char *tp_name = "__testpoint_" #_name; \
46 tp = lttng_testpoint_lookup(tp_name); \
58 /* Testpoint declaration */
59 #define TESTPOINT_DECL(name) \
62 #endif /* NTESTPOINT */