]>
git.proxmox.com Git - mirror_frr.git/blob - lib/trace.h
3 * Wraps tracepoint macros for different tracing systems to allow switching
4 * between them at compile time.
6 * This should not be included directly by source files wishing to provide
7 * tracepoints. Instead, write a header that defines LTTng tracepoints and
8 * which includes this header, and include your new header in your source. USDT
9 * probes do not need tracepoint definitions, but are less capable than LTTng
12 * Copyright (C) 2020 NVIDIA Corporation
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the Free
17 * Software Foundation; either version 2 of the License, or (at your option)
20 * This program is distributed in the hope that it will be useful, but WITHOUT
21 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
25 * You should have received a copy of the GNU General Public License along
26 * with this program; see the file COPYING; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
35 #endif /* HAVE_CONFIG_H */
39 * - frrtrace(n, provider, name, ...args...)
40 * - frrtrace_enabled(provider, name)
41 * - frrtracelog(level, msg, ...)
43 * Use frrtrace() to define tracepoints. n is the number of arguments; this is
44 * needed because USDT probe definitions use DTRACE_PROBEn macros, so the
45 * number of args must be passed in order to expand the correct macro.
47 * frrtrace_enabled() maps to tracepoint_enabled() under LTTng and is always
48 * true when using USDT. In the future it could be mapped to USDT semaphores
49 * but this is not implemented at present.
51 * frrtracelog() maps to tracelog() under LTTng and should only be used in zlog
52 * core code, to propagate zlog messages to LTTng. It expands to nothing
56 #if defined(HAVE_LTTNG)
58 #define frrtrace(nargs, provider, name, ...) \
59 tracepoint(provider, name, ## __VA_ARGS__)
60 #define frrtrace_enabled(...) tracepoint_enabled(__VA_ARGS__)
61 #define frrtracelog(...) tracelog(__VA_ARGS__)
63 #elif defined(HAVE_USDT)
67 #define frrtrace(nargs, provider, name, ...) \
68 DTRACE_PROBE##nargs(provider, name, ## __VA_ARGS__)
69 #define frrtrace_enabled(...) true
70 #define frrtracelog(...)
74 #define frrtrace(nargs, provider, name, ...) (void)0
75 #define frrtrace_enabled(...) false
76 #define frrtracelog(...) (void)0
80 #endif /* _TRACE_H_ */