Commit | Line | Data |
---|---|---|
51489cad MD |
1 | #ifndef _LTTNG_TRACEPOINT_H |
2 | #define _LTTNG_TRACEPOINT_H | |
f99be407 PMF |
3 | |
4 | /* | |
e9090899 | 5 | * Copyright (C) 2008-2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
1f8b0dff | 6 | * Copyright (C) 2009 Pierre-Marc Fournier |
22d72948 | 7 | * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org> |
f99be407 | 8 | * |
8fc2d8db PMF |
9 | * This library is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU Lesser General Public | |
f37142a4 MD |
11 | * License as published by the Free Software Foundation; |
12 | * version 2.1 of the License. | |
f99be407 | 13 | * |
8fc2d8db | 14 | * This library is distributed in the hope that it will be useful, |
1f8b0dff | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8fc2d8db PMF |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | * Lesser General Public License for more details. | |
1f8b0dff | 18 | * |
8fc2d8db PMF |
19 | * You should have received a copy of the GNU Lesser General Public |
20 | * License along with this library; if not, write to the Free Software | |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
f99be407 PMF |
22 | * |
23 | * Heavily inspired from the Linux Kernel Markers. | |
f99be407 PMF |
24 | */ |
25 | ||
b7ea1a1c | 26 | #include <urcu-bp.h> |
b0c4126f | 27 | #include <urcu/list.h> |
51489cad | 28 | #include <lttng/tracepoint-types.h> |
f99be407 | 29 | |
1ea2c2df MD |
30 | #ifdef __cplusplus |
31 | extern "C" { | |
32 | #endif | |
33 | ||
cc7b66ba MD |
34 | /* |
35 | * Tracepoints should be added to the instrumented code using the | |
36 | * "tracepoint()" macro. | |
37 | */ | |
7083f0fe MD |
38 | #define tracepoint(provider, name, args...) \ |
39 | __trace_##provider##___##name(args) | |
cc7b66ba | 40 | |
f99be407 PMF |
41 | /* |
42 | * it_func[0] is never NULL because there is at least one element in the array | |
43 | * when the array itself is non NULL. | |
44 | */ | |
63ef2693 | 45 | #define __DO_TRACE(tp, proto, vars) \ |
f99be407 | 46 | do { \ |
b979b346 MD |
47 | struct tracepoint_probe *__tp_it_probe_ptr; \ |
48 | void *__tp_it_func; \ | |
49 | void *__tp_cb_data; \ | |
f99be407 | 50 | \ |
9dec086e | 51 | rcu_read_lock(); \ |
b979b346 MD |
52 | __tp_it_probe_ptr = rcu_dereference((tp)->probes); \ |
53 | if (__tp_it_probe_ptr) { \ | |
f99be407 | 54 | do { \ |
b979b346 MD |
55 | __tp_it_func = __tp_it_probe_ptr->func; \ |
56 | __tp_cb_data = __tp_it_probe_ptr->data; \ | |
63ef2693 | 57 | URCU_FORCE_CAST(void(*)(proto), __tp_it_func)(vars); \ |
b979b346 | 58 | } while ((++__tp_it_probe_ptr)->func); \ |
f99be407 | 59 | } \ |
9dec086e | 60 | rcu_read_unlock(); \ |
f99be407 PMF |
61 | } while (0) |
62 | ||
81614639 | 63 | #define TP_PARAMS(args...) args |
63ef2693 MD |
64 | #define TP_ARGS(args...) args |
65 | ||
66 | /* | |
67 | * TP_ARGS takes tuples of type, argument separated by a comma. It can | |
68 | * take up to 10 tuples (which means that less than 10 tuples is fine | |
69 | * too). Each tuple is also separated by a comma. | |
70 | */ | |
71 | ||
72 | #define TP_COMBINE_TOKENS1(_tokena, _tokenb) _tokena##_tokenb | |
73 | #define TP_COMBINE_TOKENS(_tokena, _tokenb) TP_COMBINE_TOKENS1(_tokena, _tokenb) | |
74 | ||
75 | /* _TP_EVEN* extracts the vars names. */ | |
76 | #define _TP_EVEN0() | |
77 | #define _TP_EVEN2(a,b) b | |
78 | #define _TP_EVEN4(a,b,c,d) b,d | |
79 | #define _TP_EVEN6(a,b,c,d,e,f) b,d,f | |
80 | #define _TP_EVEN8(a,b,c,d,e,f,g,h) b,d,f,h | |
81 | #define _TP_EVEN10(a,b,c,d,e,f,g,h,i,j) b,d,f,h,j | |
82 | #define _TP_EVEN12(a,b,c,d,e,f,g,h,i,j,k,l) b,d,f,h,j,l | |
83 | #define _TP_EVEN14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) b,d,f,h,j,l,n | |
84 | #define _TP_EVEN16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) b,d,f,h,j,l,n,p | |
85 | #define _TP_EVEN18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) b,d,f,h,j,l,n,p,r | |
86 | #define _TP_EVEN20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) b,d,f,h,j,l,n,p,r,t | |
87 | ||
88 | #define _TP_EVEN_DATA0() __tp_cb_data | |
89 | #define _TP_EVEN_DATA2(a,b) __tp_cb_data,b | |
90 | #define _TP_EVEN_DATA4(a,b,c,d) __tp_cb_data,b,d | |
91 | #define _TP_EVEN_DATA6(a,b,c,d,e,f) __tp_cb_data,b,d,f | |
92 | #define _TP_EVEN_DATA8(a,b,c,d,e,f,g,h) __tp_cb_data,b,d,f,h | |
93 | #define _TP_EVEN_DATA10(a,b,c,d,e,f,g,h,i,j) __tp_cb_data,b,d,f,h,j | |
94 | #define _TP_EVEN_DATA12(a,b,c,d,e,f,g,h,i,j,k,l) __tp_cb_data,b,d,f,h,j,l | |
95 | #define _TP_EVEN_DATA14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) __tp_cb_data,b,d,f,h,j,l,n | |
96 | #define _TP_EVEN_DATA16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) __tp_cb_data,b,d,f,h,j,l,n,p | |
97 | #define _TP_EVEN_DATA18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) __tp_cb_data,b,d,f,h,j,l,n,p,r | |
98 | #define _TP_EVEN_DATA20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) __tp_cb_data,b,d,f,h,j,l,n,p,r,t | |
99 | ||
100 | /* _TP_SPLIT extracts tuples of type, var */ | |
101 | #define _TP_SPLIT0() | |
102 | #define _TP_SPLIT2(a,b) a b | |
103 | #define _TP_SPLIT4(a,b,c,d) a b,c d | |
104 | #define _TP_SPLIT6(a,b,c,d,e,f) a b,c d,e f | |
105 | #define _TP_SPLIT8(a,b,c,d,e,f,g,h) a b,c d,e f,g h | |
106 | #define _TP_SPLIT10(a,b,c,d,e,f,g,h,i,j) a b,c d,e f,g h,i j | |
107 | #define _TP_SPLIT12(a,b,c,d,e,f,g,h,i,j,k,l) a b,c d,e f,g h,i j,k l | |
108 | #define _TP_SPLIT14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) a b,c d,e f,g h,i j,k l,m n | |
109 | #define _TP_SPLIT16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) a b,c d,e f,g h,i j,k l,m n,o p | |
110 | #define _TP_SPLIT18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) a b,c d,e f,g h,i j,k l,m n,o p,q r | |
111 | #define _TP_SPLIT20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) a b,c d,e f,g h,i j,k l,m n,o p,q r,s t | |
112 | ||
113 | #define _TP_SPLIT_DATA0() void *__tp_cb_data | |
114 | #define _TP_SPLIT_DATA2(a,b) void *__tp_cb_data,a b | |
115 | #define _TP_SPLIT_DATA4(a,b,c,d) void *__tp_cb_data,a b,c d | |
116 | #define _TP_SPLIT_DATA6(a,b,c,d,e,f) void *__tp_cb_data,a b,c d,e f | |
117 | #define _TP_SPLIT_DATA8(a,b,c,d,e,f,g,h) void *__tp_cb_data,a b,c d,e f,g h | |
118 | #define _TP_SPLIT_DATA10(a,b,c,d,e,f,g,h,i,j) void *__tp_cb_data,a b,c d,e f,g h,i j | |
119 | #define _TP_SPLIT_DATA12(a,b,c,d,e,f,g,h,i,j,k,l) void *__tp_cb_data,a b,c d,e f,g h,i j,k l | |
120 | #define _TP_SPLIT_DATA14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) void *__tp_cb_data,a b,c d,e f,g h,i j,k l,m n | |
121 | #define _TP_SPLIT_DATA16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) void *__tp_cb_data,a b,c d,e f,g h,i j,k l,m n,o p | |
122 | #define _TP_SPLIT_DATA18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) void *__tp_cb_data,a b,c d,e f,g h,i j,k l,m n,o p,q r | |
123 | #define _TP_SPLIT_DATA20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) void *__tp_cb_data,a b,c d,e f,g h,i j,k l,m n,o p,q r,s t | |
124 | ||
125 | /* Preprocessor trick to count arguments. Inspired from sdt.h. */ | |
126 | #define _TP_NARGS(...) __TP_NARGS(__VA_ARGS__, 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) | |
127 | #define __TP_NARGS(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, N, ...) N | |
128 | #define _TP_PROTO_N(N, ...) \ | |
129 | TP_PARAMS(TP_COMBINE_TOKENS(_TP_SPLIT, N)(__VA_ARGS__)) | |
130 | #define _TP_VARS_N(N, ...) \ | |
131 | TP_PARAMS(TP_COMBINE_TOKENS(_TP_EVEN, N)(__VA_ARGS__)) | |
132 | #define _TP_PROTO_DATA_N(N, ...) \ | |
133 | TP_PARAMS(TP_COMBINE_TOKENS(_TP_SPLIT_DATA, N)(__VA_ARGS__)) | |
134 | #define _TP_VARS_DATA_N(N, ...) \ | |
135 | TP_PARAMS(TP_COMBINE_TOKENS(_TP_EVEN_DATA, N)(__VA_ARGS__)) | |
136 | ||
137 | #define _TP_ARGS_PROTO(...) _TP_PROTO_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) | |
138 | #define _TP_ARGS_VARS(...) _TP_VARS_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) | |
139 | ||
140 | #define _TP_ARGS_PROTO_DATA(...) _TP_PROTO_DATA_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) | |
141 | #define _TP_ARGS_VARS_DATA(...) _TP_VARS_DATA_N(_TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__) | |
81614639 | 142 | |
7083f0fe | 143 | #define __CHECK_TRACE(provider, name, proto, args) \ |
f99be407 | 144 | do { \ |
7083f0fe MD |
145 | if (caa_unlikely(__tracepoint_##provider##___##name.state)) \ |
146 | __DO_TRACE(&__tracepoint_##provider##___##name, \ | |
63ef2693 | 147 | TP_PARAMS(proto), TP_PARAMS(args)); \ |
f99be407 PMF |
148 | } while (0) |
149 | ||
150 | /* | |
151 | * Make sure the alignment of the structure in the __tracepoints section will | |
152 | * not add unwanted padding between the beginning of the section and the | |
153 | * structure. Force alignment to the same alignment as the section start. | |
f99be407 | 154 | */ |
7083f0fe MD |
155 | #define __DECLARE_TRACEPOINT(provider, name, proto, args, data_proto, data_args) \ |
156 | extern struct tracepoint __tracepoint_##provider##___##name; \ | |
157 | static inline void __trace_##provider##___##name(proto) \ | |
f99be407 | 158 | { \ |
63ef2693 MD |
159 | __CHECK_TRACE(provider, name, TP_PARAMS(data_proto), \ |
160 | TP_PARAMS(data_args)); \ | |
f99be407 | 161 | } \ |
9dec086e | 162 | static inline int \ |
7083f0fe | 163 | __register_trace_##provider##___##name(void (*probe)(data_proto), void *data) \ |
f99be407 | 164 | { \ |
7083f0fe | 165 | return __tracepoint_probe_register(#provider ":" #name, (void *) probe, \ |
9dec086e | 166 | data); \ |
f99be407 | 167 | } \ |
9dec086e | 168 | static inline int \ |
7083f0fe | 169 | __unregister_trace_##provider##___##name(void (*probe)(data_proto), void *data) \ |
f99be407 | 170 | { \ |
7083f0fe | 171 | return __tracepoint_probe_unregister(#provider ":" #name, (void *) probe, \ |
9dec086e | 172 | data); \ |
f99be407 PMF |
173 | } |
174 | ||
63ef2693 MD |
175 | #define _DECLARE_TRACEPOINT(provider, name, args) \ |
176 | __DECLARE_TRACEPOINT(provider, name, _TP_ARGS_PROTO(args), _TP_ARGS_VARS(args), \ | |
177 | _TP_ARGS_PROTO_DATA(args), _TP_ARGS_VARS_DATA(args)) | |
9dec086e | 178 | |
f99be407 | 179 | /* |
81614639 MD |
180 | * __tracepoints_ptrs section is not const (read-only) to let the linker update |
181 | * the pointer, allowing PIC code. | |
f99be407 | 182 | */ |
7083f0fe MD |
183 | #define _DEFINE_TRACEPOINT(provider, name) \ |
184 | static const char __tpstrtab_##provider##___##name[] \ | |
185 | __attribute__((section("__tracepoints_strings"))) = \ | |
186 | #provider ":" #name; \ | |
187 | struct tracepoint __tracepoint_##provider##___##name \ | |
81614639 | 188 | __attribute__((section("__tracepoints"))) = \ |
7083f0fe MD |
189 | { __tpstrtab_##provider##___##name, 0, NULL }; \ |
190 | static struct tracepoint * __tracepoint_ptr_##provider##___##name \ | |
81614639 | 191 | __attribute__((used, section("__tracepoints_ptrs"))) = \ |
7083f0fe | 192 | &__tracepoint_##provider##___##name; |
f99be407 | 193 | |
f99be407 | 194 | |
7083f0fe MD |
195 | #define __register_tracepoint(provider, name, probe, data) \ |
196 | __register_trace_##provider##___##name(probe, data) | |
197 | #define __unregister_tracepoint(provider, name, probe, data) \ | |
198 | __unregister_trace_##provider##___##name(probe, data) | |
f99be407 | 199 | |
81614639 MD |
200 | /* |
201 | * Connect a probe to a tracepoint. | |
202 | * Internal API. | |
203 | */ | |
204 | extern | |
205 | int __tracepoint_probe_register(const char *name, void *probe, void *data); | |
f99be407 PMF |
206 | |
207 | /* | |
81614639 MD |
208 | * Disconnect a probe from a tracepoint. |
209 | * Internal API. | |
f99be407 | 210 | */ |
81614639 MD |
211 | extern |
212 | int __tracepoint_probe_unregister(const char *name, void *probe, void *data); | |
f99be407 | 213 | |
81614639 MD |
214 | extern |
215 | int tracepoint_register_lib(struct tracepoint * const *tracepoints_start, | |
216 | int tracepoints_count); | |
217 | extern | |
218 | int tracepoint_unregister_lib(struct tracepoint * const *tracepoints_start); | |
872037bb | 219 | |
6cdf29f8 MD |
220 | /* |
221 | * These weak symbols, the constructor, and destructor take care of | |
222 | * registering only _one_ instance of the tracepoints per shared-ojbect | |
223 | * (or for the whole main program). | |
6cdf29f8 MD |
224 | */ |
225 | extern struct tracepoint * const __start___tracepoints_ptrs[] | |
226 | __attribute__((weak, visibility("hidden"))); | |
227 | extern struct tracepoint * const __stop___tracepoints_ptrs[] | |
228 | __attribute__((weak, visibility("hidden"))); | |
229 | int __tracepoint_registered | |
230 | __attribute__((weak, visibility("hidden"))); | |
231 | ||
232 | static void __attribute__((constructor)) __tracepoints__init(void) | |
233 | { | |
234 | if (__tracepoint_registered++) | |
235 | return; | |
236 | tracepoint_register_lib(__start___tracepoints_ptrs, | |
237 | __stop___tracepoints_ptrs - | |
238 | __start___tracepoints_ptrs); | |
239 | } | |
240 | ||
241 | static void __attribute__((destructor)) __tracepoints__destroy(void) | |
242 | { | |
243 | if (--__tracepoint_registered) | |
244 | return; | |
245 | tracepoint_unregister_lib(__start___tracepoints_ptrs); | |
246 | } | |
22d72948 | 247 | |
8d71973c | 248 | #ifndef TRACEPOINT_EVENT |
22d72948 | 249 | /* |
d75775a6 MD |
250 | * Usage of the TRACEPOINT_EVENT macro: |
251 | * | |
252 | * In short, an example: | |
253 | * | |
7083f0fe | 254 | * TRACEPOINT_EVENT(< [com_company_]project[_component] >, < event >, |
63ef2693 MD |
255 | * |
256 | * * TP_ARGS takes from 0 to 10 "type, field_name" pairs * | |
257 | * | |
258 | * TP_ARGS(int, arg0, void *, arg1, char *, string, size_t, strlen, | |
259 | * long *, arg4, size_t, arg4_len), | |
d75775a6 MD |
260 | * TP_FIELDS( |
261 | * | |
262 | * * Integer, printed in base 10 * | |
263 | * ctf_integer(int, field_a, arg0) | |
264 | * | |
265 | * * Integer, printed with 0x base 16 * | |
266 | * ctf_integer_hex(unsigned long, field_d, arg1) | |
267 | * | |
268 | * * Array Sequence, printed as UTF8-encoded array of bytes * | |
269 | * ctf_array_text(char, field_b, string, FIXED_LEN) | |
270 | * ctf_sequence_text(char, field_c, string, size_t, strlen) | |
271 | * | |
272 | * * String, printed as UTF8-encoded string * | |
273 | * ctf_string(field_e, string) | |
274 | * | |
275 | * * Array sequence of signed integer values * | |
276 | * ctf_array(long, field_f, arg4, FIXED_LEN4) | |
277 | * ctf_sequence(long, field_g, arg4, size_t, arg4_len) | |
278 | * ) | |
279 | * ) | |
280 | * | |
281 | * In more detail: | |
22d72948 | 282 | * |
0a42beb6 MD |
283 | * We define a tracepoint, its arguments, and its 'fast binary record' |
284 | * layout. | |
22d72948 | 285 | * |
7083f0fe | 286 | * Firstly, name your tracepoint via TRACEPOINT_EVENT(provider, name, |
22d72948 | 287 | * |
7083f0fe MD |
288 | * The provider and name should be a proper C99 identifier. |
289 | * The "provider" and "name" MUST follow these rules to ensure no | |
290 | * namespace clash occurs: | |
22d72948 | 291 | * |
0a42beb6 MD |
292 | * For projects (applications and libraries) for which an entity |
293 | * specific to the project controls the source code and thus its | |
294 | * tracepoints (typically with a scope larger than a single company): | |
22d72948 | 295 | * |
0a42beb6 | 296 | * either: |
7083f0fe | 297 | * project_component, event |
0a42beb6 | 298 | * or: |
7083f0fe | 299 | * project, event |
0a42beb6 MD |
300 | * |
301 | * Where "project" is the name of the project, | |
d5001b43 MD |
302 | * "component" is the name of the project component (which may |
303 | * include several levels of sub-components, e.g. | |
304 | * ...component_subcomponent_...) where the tracepoint is located | |
305 | * (optional), | |
0a42beb6 MD |
306 | * "event" is the name of the tracepoint event. |
307 | * | |
308 | * For projects issued from a single company wishing to advertise that | |
309 | * the company controls the source code and thus the tracepoints, the | |
310 | * "com_" prefix should be used: | |
311 | * | |
312 | * either: | |
7083f0fe | 313 | * com_company_project_component, event |
0a42beb6 | 314 | * or: |
7083f0fe | 315 | * com_company_project, event |
0a42beb6 MD |
316 | * |
317 | * Where "company" is the name of the company, | |
318 | * "project" is the name of the project, | |
d5001b43 MD |
319 | * "component" is the name of the project component (which may |
320 | * include several levels of sub-components, e.g. | |
321 | * ...component_subcomponent_...) where the tracepoint is located | |
322 | * (optional), | |
0a42beb6 MD |
323 | * "event" is the name of the tracepoint event. |
324 | * | |
b43de1e7 | 325 | * the provider:event identifier is limited to 127 characters. |
0a42beb6 MD |
326 | * |
327 | * As an example, let's consider a user-space application "someproject" | |
328 | * that would have an internal thread scheduler: | |
329 | * | |
7083f0fe | 330 | * TRACEPOINT_EVENT(someproject_sched, switch, |
22d72948 NC |
331 | * |
332 | * * | |
63ef2693 MD |
333 | * * Arguments to pass to the tracepoint. Supports from |
334 | * * 0 to 10 "type, name" tuples. | |
22d72948 NC |
335 | * * |
336 | * | |
63ef2693 MD |
337 | * TP_ARGS(struct rq *, rq, struct task_struct *, prev, |
338 | * struct task_struct *, next), | |
22d72948 NC |
339 | * |
340 | * * | |
341 | * * Fast binary tracing: define the trace record via | |
81614639 | 342 | * * TP_FIELDS(). You can think about it like a |
22d72948 NC |
343 | * * regular C structure local variable definition. |
344 | * * | |
345 | * * This is how the trace record is structured and will | |
346 | * * be saved into the ring buffer. These are the fields | |
347 | * * that will be exposed to readers. | |
348 | * * | |
0a42beb6 | 349 | * * ctf_integer(pid_t, prev_pid, prev->pid) is equivalent |
81614639 | 350 | * * to a standard declaraton: |
22d72948 | 351 | * * |
81614639 | 352 | * * pid_t prev_pid; |
22d72948 | 353 | * * |
81614639 | 354 | * * followed by an assignment: |
22d72948 | 355 | * * |
81614639 | 356 | * * prev_pid = prev->pid; |
22d72948 | 357 | * * |
0a42beb6 | 358 | * * ctf_array(char, prev_comm, prev->comm, TASK_COMM_LEN) is |
81614639 | 359 | * * equivalent to: |
22d72948 | 360 | * * |
81614639 | 361 | * * char prev_comm[TASK_COMM_LEN]; |
22d72948 | 362 | * * |
81614639 | 363 | * * followed by an assignment: |
22d72948 | 364 | * * |
81614639 | 365 | * * memcpy(prev_comm, prev->comm, TASK_COMM_LEN); |
22d72948 NC |
366 | * * |
367 | * | |
81614639 | 368 | * TP_FIELDS( |
0a42beb6 MD |
369 | * ctf_array(char, prev_comm, prev->comm, TASK_COMM_LEN) |
370 | * ctf_integer(pid_t, prev_pid, prev->pid) | |
371 | * ctf_integer(int, prev_prio, prev->prio) | |
372 | * ctf_array(char, next_comm, next->comm, TASK_COMM_LEN) | |
373 | * ctf_integer(pid_t, next_pid, next->pid) | |
374 | * ctf_integer(int, next_prio, next->prio) | |
22d72948 | 375 | * ) |
0a42beb6 | 376 | * ) |
abcdecad MD |
377 | * |
378 | * Do _NOT_ add comma (,) nor semicolon (;) after the TRACEPOINT_EVENT | |
379 | * declaration. | |
380 | * | |
a4ada9b8 | 381 | * The TRACEPOINT_PROVIDER must be defined when declaring a |
abcdecad MD |
382 | * TRACEPOINT_EVENT. See ust/tracepoint-event.h for information about |
383 | * usage of other macros controlling TRACEPOINT_EVENT. | |
22d72948 NC |
384 | */ |
385 | ||
63ef2693 MD |
386 | #define TRACEPOINT_EVENT(provider, name, args, fields) \ |
387 | _DECLARE_TRACEPOINT(provider, name, TP_PARAMS(args)) | |
0c0686ee | 388 | |
63ef2693 MD |
389 | #define TRACEPOINT_EVENT_CLASS(provider, name, args, fields) |
390 | #define TRACEPOINT_EVENT_INSTANCE(provider, template, name, args)\ | |
391 | _DECLARE_TRACEPOINT(provider, name, TP_PARAMS(args)) | |
0c0686ee | 392 | |
81614639 | 393 | #endif /* #ifndef TRACEPOINT_EVENT */ |
22d72948 | 394 | |
abcdecad MD |
395 | #ifndef TRACEPOINT_LOGLEVEL |
396 | ||
397 | /* | |
398 | * Tracepoint Loglevel Declaration Facility | |
399 | * | |
400 | * This is a place-holder the tracepoint loglevel declaration, | |
401 | * overridden by the tracer implementation. | |
402 | * | |
403 | * Typical use of these loglevels: | |
404 | * | |
405 | * 1) Declare the mapping between loglevel names and an integer values | |
406 | * within TRACEPOINT_LOGLEVEL_ENUM, using TP_LOGLEVEL for each tuple. | |
407 | * Do _NOT_ add comma (,) nor semicolon (;) between the | |
408 | * TRACEPOINT_LOGLEVEL_ENUM entries. Do _NOT_ add comma (,) nor | |
409 | * semicolon (;) after the TRACEPOINT_LOGLEVEL_ENUM declaration. The | |
410 | * name should be a proper C99 identifier. | |
411 | * | |
412 | * TRACEPOINT_LOGLEVEL_ENUM( | |
413 | * TP_LOGLEVEL( < loglevel_name >, < value > ) | |
414 | * TP_LOGLEVEL( < loglevel_name >, < value > ) | |
415 | * ... | |
416 | * ) | |
417 | * | |
418 | * e.g.: | |
419 | * | |
420 | * TRACEPOINT_LOGLEVEL_ENUM( | |
421 | * TP_LOGLEVEL(LOG_EMERG, 0) | |
422 | * TP_LOGLEVEL(LOG_ALERT, 1) | |
423 | * TP_LOGLEVEL(LOG_CRIT, 2) | |
424 | * TP_LOGLEVEL(LOG_ERR, 3) | |
425 | * TP_LOGLEVEL(LOG_WARNING, 4) | |
426 | * TP_LOGLEVEL(LOG_NOTICE, 5) | |
427 | * TP_LOGLEVEL(LOG_INFO, 6) | |
428 | * TP_LOGLEVEL(LOG_DEBUG, 7) | |
429 | * ) | |
430 | * | |
e9f37b4c MD |
431 | * 2) Then, declare tracepoint loglevels for tracepoints. A |
432 | * TRACEPOINT_EVENT should be declared prior to the the | |
433 | * TRACEPOINT_LOGLEVEL for a given tracepoint name. The first field | |
434 | * is the name of the tracepoint, the second field is the loglevel | |
435 | * name. | |
abcdecad | 436 | * |
7083f0fe | 437 | * TRACEPOINT_LOGLEVEL(< [com_company_]project[_component] >, < event >, |
abcdecad MD |
438 | * < loglevel_name >) |
439 | * | |
a4ada9b8 | 440 | * The TRACEPOINT_PROVIDER must be defined when declaring a |
abcdecad | 441 | * TRACEPOINT_LOGLEVEL_ENUM and TRACEPOINT_LOGLEVEL. The tracepoint |
a4ada9b8 | 442 | * loglevel enumeration apply to the entire TRACEPOINT_PROVIDER. Only one |
abcdecad | 443 | * tracepoint loglevel enumeration should be declared per tracepoint |
a4ada9b8 | 444 | * provider. |
abcdecad MD |
445 | */ |
446 | ||
447 | #define TRACEPOINT_LOGLEVEL_ENUM() | |
448 | #define TRACEPOINT_LOGLEVEL(name, loglevel) | |
449 | ||
450 | #endif /* #ifndef TRACEPOINT_LOGLEVEL */ | |
451 | ||
1ea2c2df MD |
452 | #ifdef __cplusplus |
453 | } | |
454 | #endif | |
455 | ||
51489cad | 456 | #endif /* _LTTNG_TRACEPOINT_H */ |