2 * Copyright (C) 2012 - Christian Babeux <christian.babeux@efficios.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #define testpoint(name)
21 #define TESTPOINT_DECL(name)
23 #else /* NTESTPOINT */
25 #include <urcu.h> /* for caa_likely/unlikely */
27 extern int lttng_testpoint_activated
;
29 void *lttng_testpoint_lookup(const char *name
);
32 * Testpoint is only active if the global lttng_testpoint_activated flag is
34 * Return a non-zero error code to indicate failure.
36 #define testpoint(name) \
37 ((caa_unlikely(lttng_testpoint_activated)) \
38 ? __testpoint_##name##_wrapper() : 0)
41 * One wrapper per testpoint is generated. This is to keep track of the symbol
42 * lookup status and the corresponding function pointer, if any.
44 #define _TESTPOINT_DECL(_name) \
45 static inline int __testpoint_##_name##_wrapper(void) \
48 static int (*tp)(void); \
50 const char *tp_name = "__testpoint_" #_name; \
56 tp = lttng_testpoint_lookup(tp_name); \
68 /* Testpoint declaration */
69 #define TESTPOINT_DECL(name) \
72 #endif /* NTESTPOINT */