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 */
21 extern int lttng_testpoint_activated
;
23 void *lttng_testpoint_lookup(const char *name
);
26 * Testpoint is only active if the global lttng_testpoint_activated flag is
28 * Return a non-zero error code to indicate failure.
30 #define testpoint(name) \
31 ((caa_unlikely(lttng_testpoint_activated)) \
32 ? __testpoint_##name##_wrapper() : 0)
35 * One wrapper per testpoint is generated. This is to keep track of the symbol
36 * lookup status and the corresponding function pointer, if any.
38 #define _TESTPOINT_DECL(_name) \
39 static inline int __testpoint_##_name##_wrapper(void) \
42 static int (*tp)(void); \
44 const char *tp_name = "__testpoint_" #_name; \
50 tp = (int (*)(void)) lttng_testpoint_lookup(tp_name); \
62 /* Testpoint declaration */
63 #define TESTPOINT_DECL(name) \
70 #endif /* NTESTPOINT */