Commit | Line | Data |
---|---|---|
17baffe2 MD |
1 | /* |
2 | * define_trace.h | |
3 | * | |
4 | * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org> | |
886d51a3 | 5 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
17baffe2 | 6 | * |
886d51a3 MD |
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 | |
17baffe2 MD |
20 | */ |
21 | ||
f62b389e MD |
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 | ||
76e4f017 | 56 | #undef TRACE_EVENT_MAP |
20591cf7 | 57 | #define TRACE_EVENT_MAP(name, map, proto, args, tstruct, assign, print) |
76e4f017 MD |
58 | |
59 | #undef TRACE_EVENT_CONDITION_MAP | |
60 | #define TRACE_EVENT_CONDITION_MAP(name, map, proto, args, cond, tstruct, assign, print) \ | |
61 | TRACE_EVENT(name, \ | |
62 | PARAMS(proto), \ | |
63 | PARAMS(args), \ | |
64 | PARAMS(tstruct), \ | |
65 | PARAMS(assign), \ | |
66 | PARAMS(print)) | |
67 | ||
68 | #undef TRACE_EVENT_FN_MAP | |
69 | #define TRACE_EVENT_FN_MAP(name, map, proto, args, tstruct, \ | |
20591cf7 | 70 | assign, print, reg, unreg) |
76e4f017 MD |
71 | |
72 | #undef DEFINE_EVENT_MAP | |
20591cf7 | 73 | #define DEFINE_EVENT_MAP(template, name, map, proto, args) |
76e4f017 MD |
74 | |
75 | #undef DEFINE_EVENT_PRINT_MAP | |
20591cf7 | 76 | #define DEFINE_EVENT_PRINT_MAP(template, name, map, proto, args, print) |
76e4f017 MD |
77 | |
78 | #undef DEFINE_EVENT_CONDITION_MAP | |
79 | #define DEFINE_EVENT_CONDITION_MAP(template, name, map, proto, args, cond) \ | |
80 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | |
81 | ||
82 | ||
f62b389e | 83 | #undef TRACE_EVENT |
20591cf7 | 84 | #define TRACE_EVENT(name, proto, args, tstruct, assign, print) |
f62b389e MD |
85 | |
86 | #undef TRACE_EVENT_CONDITION | |
87 | #define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \ | |
88 | TRACE_EVENT(name, \ | |
89 | PARAMS(proto), \ | |
90 | PARAMS(args), \ | |
91 | PARAMS(tstruct), \ | |
92 | PARAMS(assign), \ | |
93 | PARAMS(print)) | |
94 | ||
7ca580f8 MD |
95 | #undef LTTNG_TRACE_EVENT |
96 | #define LTTNG_TRACE_EVENT(name, proto, args, _locvar, _code, tstruct, assign, print) | |
97 | ||
f62b389e MD |
98 | #undef TRACE_EVENT_FN |
99 | #define TRACE_EVENT_FN(name, proto, args, tstruct, \ | |
20591cf7 | 100 | assign, print, reg, unreg) |
f62b389e MD |
101 | |
102 | #undef DEFINE_EVENT | |
20591cf7 | 103 | #define DEFINE_EVENT(template, name, proto, args) |
f62b389e MD |
104 | |
105 | #undef DEFINE_EVENT_PRINT | |
20591cf7 | 106 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) |
f62b389e MD |
107 | |
108 | #undef DEFINE_EVENT_CONDITION | |
109 | #define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \ | |
110 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | |
111 | ||
112 | #undef DECLARE_TRACE | |
20591cf7 | 113 | #define DECLARE_TRACE(name, proto, args) |
f62b389e MD |
114 | |
115 | #undef TRACE_INCLUDE | |
116 | #undef __TRACE_INCLUDE | |
117 | ||
118 | #ifndef TRACE_INCLUDE_FILE | |
119 | # define TRACE_INCLUDE_FILE TRACE_SYSTEM | |
120 | # define UNDEF_TRACE_INCLUDE_FILE | |
121 | #endif | |
122 | ||
123 | #ifndef TRACE_INCLUDE_PATH | |
124 | # define __TRACE_INCLUDE(system) <trace/events/system.h> | |
125 | # define UNDEF_TRACE_INCLUDE_PATH | |
126 | #else | |
127 | # define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h) | |
128 | #endif | |
129 | ||
130 | # define TRACE_INCLUDE(system) __TRACE_INCLUDE(system) | |
131 | ||
132 | /* Let the trace headers be reread */ | |
133 | #define TRACE_HEADER_MULTI_READ | |
134 | ||
135 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | |
136 | ||
137 | /* Make all open coded DECLARE_TRACE nops */ | |
138 | #undef DECLARE_TRACE | |
139 | #define DECLARE_TRACE(name, proto, args) | |
140 | ||
141 | #ifdef LTTNG_PACKAGE_BUILD | |
142 | #include "lttng-events.h" | |
143 | #endif | |
144 | ||
145 | #undef TRACE_EVENT | |
146 | #undef TRACE_EVENT_FN | |
147 | #undef TRACE_EVENT_CONDITION | |
f62b389e MD |
148 | #undef DEFINE_EVENT |
149 | #undef DEFINE_EVENT_PRINT | |
150 | #undef DEFINE_EVENT_CONDITION | |
76e4f017 MD |
151 | #undef TRACE_EVENT_MAP |
152 | #undef TRACE_EVENT_FN_MAP | |
153 | #undef TRACE_EVENT_CONDITION_MAP | |
154 | #undef DECLARE_EVENT_CLASS | |
155 | #undef DEFINE_EVENT_MAP | |
156 | #undef DEFINE_EVENT_PRINT_MAP | |
157 | #undef DEFINE_EVENT_CONDITION_MAP | |
f62b389e | 158 | #undef TRACE_HEADER_MULTI_READ |
f62b389e | 159 | |
7ca580f8 MD |
160 | #undef LTTNG_TRACE_EVENT |
161 | #define LTTNG_TRACE_EVENT(name, proto, args, _locvar, _code, tstruct, assign, print) | |
162 | ||
f62b389e MD |
163 | /* Only undef what we defined in this file */ |
164 | #ifdef UNDEF_TRACE_INCLUDE_FILE | |
165 | # undef TRACE_INCLUDE_FILE | |
166 | # undef UNDEF_TRACE_INCLUDE_FILE | |
167 | #endif | |
168 | ||
169 | #ifdef UNDEF_TRACE_INCLUDE_PATH | |
170 | # undef TRACE_INCLUDE_PATH | |
171 | # undef UNDEF_TRACE_INCLUDE_PATH | |
172 | #endif | |
173 | ||
174 | /* We may be processing more files */ | |
175 | #define CREATE_TRACE_POINTS | |
176 | ||
177 | #endif /* CREATE_TRACE_POINTS */ |