e90310313932353f5a8f5729d2ceb0a2aee463bd
[lttng-modules.git] / probes / define_trace.h
1 /*
2 * define_trace.h
3 *
4 * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org>
5 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; only
10 * version 2.1 of the License.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /*
23 * Trace files that want to automate creationg of all tracepoints defined
24 * in their file should include this file. The following are macros that the
25 * trace file may define:
26 *
27 * TRACE_SYSTEM defines the system the tracepoint is for
28 *
29 * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h
30 * This macro may be defined to tell define_trace.h what file to include.
31 * Note, leave off the ".h".
32 *
33 * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace
34 * then this macro can define the path to use. Note, the path is relative to
35 * define_trace.h, not the file including it. Full path names for out of tree
36 * modules must be used.
37 */
38
39 #ifdef CREATE_TRACE_POINTS
40
41 /* Prevent recursion */
42 #undef CREATE_TRACE_POINTS
43
44 #include <linux/stringify.h>
45 /*
46 * module.h includes tracepoints, and because ftrace.h
47 * pulls in module.h:
48 * trace/ftrace.h -> linux/ftrace_event.h -> linux/perf_event.h ->
49 * linux/ftrace.h -> linux/module.h
50 * we must include module.h here before we play with any of
51 * the TRACE_EVENT() macros, otherwise the tracepoints included
52 * by module.h may break the build.
53 */
54 #include <linux/module.h>
55
56 #undef TRACE_EVENT
57 #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
58 DEFINE_TRACE(name)
59
60 #undef TRACE_EVENT_CONDITION
61 #define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
62 TRACE_EVENT(name, \
63 PARAMS(proto), \
64 PARAMS(args), \
65 PARAMS(tstruct), \
66 PARAMS(assign), \
67 PARAMS(print))
68
69 #undef TRACE_EVENT_FN
70 #define TRACE_EVENT_FN(name, proto, args, tstruct, \
71 assign, print, reg, unreg) \
72 DEFINE_TRACE_FN(name, reg, unreg)
73
74 #undef DEFINE_EVENT
75 #define DEFINE_EVENT(template, name, proto, args) \
76 DEFINE_TRACE(name)
77
78 #undef DEFINE_EVENT_PRINT
79 #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
80 DEFINE_TRACE(name)
81
82 #undef DEFINE_EVENT_CONDITION
83 #define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
84 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
85
86 #undef DECLARE_TRACE
87 #define DECLARE_TRACE(name, proto, args) \
88 DEFINE_TRACE(name)
89
90 #undef TRACE_INCLUDE
91 #undef __TRACE_INCLUDE
92
93 #ifndef TRACE_INCLUDE_FILE
94 # define TRACE_INCLUDE_FILE TRACE_SYSTEM
95 # define UNDEF_TRACE_INCLUDE_FILE
96 #endif
97
98 #ifndef TRACE_INCLUDE_PATH
99 # define __TRACE_INCLUDE(system) <trace/events/system.h>
100 # define UNDEF_TRACE_INCLUDE_PATH
101 #else
102 # define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
103 #endif
104
105 # define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
106
107 /* Let the trace headers be reread */
108 #define TRACE_HEADER_MULTI_READ
109
110 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
111
112 /* Make all open coded DECLARE_TRACE nops */
113 #undef DECLARE_TRACE
114 #define DECLARE_TRACE(name, proto, args)
115
116 #ifdef LTTNG_PACKAGE_BUILD
117 #include "lttng-events.h"
118 #endif
119
120 #undef TRACE_EVENT
121 #undef TRACE_EVENT_FN
122 #undef TRACE_EVENT_CONDITION
123 #undef DECLARE_EVENT_CLASS
124 #undef DEFINE_EVENT
125 #undef DEFINE_EVENT_PRINT
126 #undef DEFINE_EVENT_CONDITION
127 #undef TRACE_HEADER_MULTI_READ
128 #undef DECLARE_TRACE
129
130 /* Only undef what we defined in this file */
131 #ifdef UNDEF_TRACE_INCLUDE_FILE
132 # undef TRACE_INCLUDE_FILE
133 # undef UNDEF_TRACE_INCLUDE_FILE
134 #endif
135
136 #ifdef UNDEF_TRACE_INCLUDE_PATH
137 # undef TRACE_INCLUDE_PATH
138 # undef UNDEF_TRACE_INCLUDE_PATH
139 #endif
140
141 /* We may be processing more files */
142 #define CREATE_TRACE_POINTS
143
144 #endif /* CREATE_TRACE_POINTS */
This page took 0.033444 seconds and 3 git commands to generate.