]>
git.proxmox.com Git - mirror_frr.git/blob - lib/trace.h
a30f53cacda00d8ff01eae18c15d051e39a534a3
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Wraps tracepoint macros for different tracing systems to allow switching
5 * between them at compile time.
7 * This should not be included directly by source files wishing to provide
8 * tracepoints. Instead, write a header that defines LTTng tracepoints and
9 * which includes this header, and include your new header in your source. USDT
10 * probes do not need tracepoint definitions, but are less capable than LTTng
13 * Copyright (C) 2020 NVIDIA Corporation
22 #endif /* HAVE_CONFIG_H */
26 * - frrtrace(n, provider, name, ...args...)
27 * - frrtrace_enabled(provider, name)
28 * - frrtracelog(level, msg, ...)
30 * Use frrtrace() to define tracepoints. n is the number of arguments; this is
31 * needed because USDT probe definitions use DTRACE_PROBEn macros, so the
32 * number of args must be passed in order to expand the correct macro.
34 * frrtrace_enabled() maps to tracepoint_enabled() under LTTng and is always
35 * true when using USDT. In the future it could be mapped to USDT semaphores
36 * but this is not implemented at present.
38 * frrtracelog() maps to tracelog() under LTTng and should only be used in zlog
39 * core code, to propagate zlog messages to LTTng. It expands to nothing
43 #if defined(HAVE_LTTNG)
45 #define frrtrace(nargs, provider, name, ...) \
46 tracepoint(provider, name, ## __VA_ARGS__)
47 #define frrtrace_enabled(...) tracepoint_enabled(__VA_ARGS__)
48 #define frrtracelog(...) tracelog(__VA_ARGS__)
50 #elif defined(HAVE_USDT)
54 #define frrtrace(nargs, provider, name, ...) \
55 DTRACE_PROBE##nargs(provider, name, ## __VA_ARGS__)
56 #define frrtrace_enabled(...) true
57 #define frrtracelog(...)
61 #define frrtrace(nargs, provider, name, ...) (void)0
62 #define frrtrace_enabled(...) false
63 #define frrtracelog(...) (void)0
67 #endif /* _TRACE_H_ */