0c8ae0c761b729ef2a6a9ee0a66cc71838b29092
[lttng-modules.git] / probes / lttng-events.h
1 /*
2 * lttng-events.h
3 *
4 * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org>
5 * Copyright (C) 2010-2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 *
7 * Dual LGPL v2.1/GPL v2 license.
8 */
9
10 #include <linux/debugfs.h>
11 #include "lttng.h"
12 #include "lttng-types.h"
13 #include "../wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
14 #include "../wrapper/ringbuffer/frontend_types.h"
15 #include "../ltt-events.h"
16 #include "../ltt-tracer-core.h"
17
18 /*
19 * Macro declarations used for all stages.
20 */
21
22 /*
23 * DECLARE_EVENT_CLASS can be used to add a generic function
24 * handlers for events. That is, if all events have the same
25 * parameters and just have distinct trace points.
26 * Each tracepoint can be defined with DEFINE_EVENT and that
27 * will map the DECLARE_EVENT_CLASS to the tracepoint.
28 *
29 * TRACE_EVENT is a one to one mapping between tracepoint and template.
30 */
31
32 #undef TRACE_EVENT
33 #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
34 DECLARE_EVENT_CLASS(name, \
35 PARAMS(proto), \
36 PARAMS(args), \
37 PARAMS(tstruct), \
38 PARAMS(assign), \
39 PARAMS(print)) \
40 DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args))
41
42 #undef TRACE_EVENT_NOARGS
43 #define TRACE_EVENT_NOARGS(name, tstruct, assign, print) \
44 DECLARE_EVENT_CLASS_NOARGS(name, \
45 PARAMS(tstruct), \
46 PARAMS(assign), \
47 PARAMS(print)) \
48 DEFINE_EVENT_NOARGS(name, name)
49
50
51 #undef DEFINE_EVENT_PRINT
52 #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
53 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
54
55 /* Callbacks are meaningless to LTTng. */
56 #undef TRACE_EVENT_FN
57 #define TRACE_EVENT_FN(name, proto, args, tstruct, \
58 assign, print, reg, unreg) \
59 TRACE_EVENT(name, PARAMS(proto), PARAMS(args), \
60 PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \
61
62 /*
63 * Stage 1 of the trace events.
64 *
65 * Create dummy trace calls for each events, verifying that the LTTng module
66 * TRACE_EVENT headers match the kernel arguments. Will be optimized out by the
67 * compiler.
68 */
69
70 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
71
72 #undef TP_PROTO
73 #define TP_PROTO(args...) args
74
75 #undef TP_ARGS
76 #define TP_ARGS(args...) args
77
78 #undef DEFINE_EVENT
79 #define DEFINE_EVENT(_template, _name, _proto, _args) \
80 void trace_##_name(_proto);
81
82 #undef DEFINE_EVENT_NOARGS
83 #define DEFINE_EVENT_NOARGS(_template, _name) \
84 void trace_##_name(void *__data);
85
86 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
87
88 /*
89 * Stage 2 of the trace events.
90 *
91 * Create event field type metadata section.
92 * Each event produce an array of fields.
93 */
94
95 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
96
97 /* Named field types must be defined in lttng-types.h */
98
99 #undef __field_full
100 #define __field_full(_type, _item, _order, _base) \
101 { \
102 .name = #_item, \
103 .type = __type_integer(_type, _order, _base, none), \
104 },
105
106 #undef __field
107 #define __field(_type, _item) \
108 __field_full(_type, _item, __BYTE_ORDER, 10)
109
110 #undef __field_ext
111 #define __field_ext(_type, _item, _filter_type) \
112 __field(_type, _item)
113
114 #undef __field_hex
115 #define __field_hex(_type, _item) \
116 __field_full(_type, _item, __BYTE_ORDER, 16)
117
118 #undef __field_network
119 #define __field_network(_type, _item) \
120 __field_full(_type, _item, __BIG_ENDIAN, 10)
121
122 #undef __field_network_hex
123 #define __field_network_hex(_type, _item) \
124 __field_full(_type, _item, __BIG_ENDIAN, 16)
125
126 #undef __array_enc_ext
127 #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
128 { \
129 .name = #_item, \
130 .type = \
131 { \
132 .atype = atype_array, \
133 .u.array = \
134 { \
135 .length = _length, \
136 .elem_type = __type_integer(_type, _order, _base, _encoding), \
137 }, \
138 }, \
139 },
140
141 #undef __array
142 #define __array(_type, _item, _length) \
143 __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, none)
144
145 #undef __array_text
146 #define __array_text(_type, _item, _length) \
147 __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, UTF8)
148
149 #undef __array_hex
150 #define __array_hex(_type, _item, _length) \
151 __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 16, none)
152
153 #undef __dynamic_array_enc_ext
154 #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding) \
155 { \
156 .name = #_item, \
157 .type = \
158 { \
159 .atype = atype_sequence, \
160 .u.sequence = \
161 { \
162 .length_type = __type_integer(u32, __BYTE_ORDER, 10, none), \
163 .elem_type = __type_integer(_type, _order, _base, _encoding), \
164 }, \
165 }, \
166 },
167
168 #undef __dynamic_array
169 #define __dynamic_array(_type, _item, _length) \
170 __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, none)
171
172 #undef __dynamic_array_text
173 #define __dynamic_array_text(_type, _item, _length) \
174 __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, UTF8)
175
176 #undef __dynamic_array_hex
177 #define __dynamic_array_hex(_type, _item, _length) \
178 __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 16, none)
179
180 #undef __string
181 #define __string(_item, _src) \
182 { \
183 .name = #_item, \
184 .type = \
185 { \
186 .atype = atype_string, \
187 .u.basic.string.encoding = lttng_encode_UTF8, \
188 }, \
189 },
190
191 #undef __string_from_user
192 #define __string_from_user(_item, _src) \
193 __string(_item, _src)
194
195 #undef TP_STRUCT__entry
196 #define TP_STRUCT__entry(args...) args /* Only one used in this phase */
197
198 #undef DECLARE_EVENT_CLASS_NOARGS
199 #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
200 static const struct lttng_event_field __event_fields___##_name[] = { \
201 _tstruct \
202 };
203
204 #undef DECLARE_EVENT_CLASS
205 #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
206 DECLARE_EVENT_CLASS_NOARGS(_name, PARAMS(_tstruct), PARAMS(_assign), \
207 PARAMS(_print))
208
209 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
210
211 /*
212 * Stage 3 of the trace events.
213 *
214 * Create probe callback prototypes.
215 */
216
217 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
218
219 #undef TP_PROTO
220 #define TP_PROTO(args...) args
221
222 #undef DECLARE_EVENT_CLASS
223 #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
224 static void __event_probe__##_name(void *__data, _proto);
225
226 #undef DECLARE_EVENT_CLASS_NOARGS
227 #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
228 static void __event_probe__##_name(void *__data);
229
230 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
231
232 /*
233 * Stage 3.9 of the trace events.
234 *
235 * Create event descriptions.
236 */
237
238 /* Named field types must be defined in lttng-types.h */
239
240 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
241
242 #ifndef TP_PROBE_CB
243 #define TP_PROBE_CB(_template) &__event_probe__##_template
244 #endif
245
246 #undef DEFINE_EVENT_NOARGS
247 #define DEFINE_EVENT_NOARGS(_template, _name) \
248 static const struct lttng_event_desc __event_desc___##_name = { \
249 .fields = __event_fields___##_template, \
250 .name = #_name, \
251 .probe_callback = (void *) TP_PROBE_CB(_template), \
252 .nr_fields = ARRAY_SIZE(__event_fields___##_template), \
253 .owner = THIS_MODULE, \
254 };
255
256 #undef DEFINE_EVENT
257 #define DEFINE_EVENT(_template, _name, _proto, _args) \
258 DEFINE_EVENT_NOARGS(_template, _name)
259
260 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
261
262
263 /*
264 * Stage 4 of the trace events.
265 *
266 * Create an array of event description pointers.
267 */
268
269 /* Named field types must be defined in lttng-types.h */
270
271 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
272
273 #undef DEFINE_EVENT_NOARGS
274 #define DEFINE_EVENT_NOARGS(_template, _name) \
275 &__event_desc___##_name,
276
277 #undef DEFINE_EVENT
278 #define DEFINE_EVENT(_template, _name, _proto, _args) \
279 DEFINE_EVENT_NOARGS(_template, _name)
280
281 #define TP_ID1(_token, _system) _token##_system
282 #define TP_ID(_token, _system) TP_ID1(_token, _system)
283
284 static const struct lttng_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
285 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
286 };
287
288 #undef TP_ID1
289 #undef TP_ID
290
291
292 /*
293 * Stage 5 of the trace events.
294 *
295 * Create a toplevel descriptor for the whole probe.
296 */
297
298 #define TP_ID1(_token, _system) _token##_system
299 #define TP_ID(_token, _system) TP_ID1(_token, _system)
300
301 /* non-const because list head will be modified when registered. */
302 static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
303 .event_desc = TP_ID(__event_desc___, TRACE_SYSTEM),
304 .nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)),
305 };
306
307 #undef TP_ID1
308 #undef TP_ID
309
310 /*
311 * Stage 6 of the trace events.
312 *
313 * Create static inline function that calculates event size.
314 */
315
316 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
317
318 /* Named field types must be defined in lttng-types.h */
319
320 #undef __field_full
321 #define __field_full(_type, _item, _order, _base) \
322 __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
323 __event_len += sizeof(_type);
324
325 #undef __array_enc_ext
326 #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) \
327 __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
328 __event_len += sizeof(_type) * (_length);
329
330 #undef __dynamic_array_enc_ext
331 #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
332 __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(u32)); \
333 __event_len += sizeof(u32); \
334 __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
335 __dynamic_len[__dynamic_len_idx] = (_length); \
336 __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \
337 __dynamic_len_idx++;
338
339 #undef __string
340 #define __string(_item, _src) \
341 __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1;
342
343 /* strlen_user includes \0 */
344 #undef __string_from_user
345 #define __string_from_user(_item, _src) \
346 __event_len += __dynamic_len[__dynamic_len_idx++] = strlen_user(_src);
347
348 #undef TP_PROTO
349 #define TP_PROTO(args...) args
350
351 #undef TP_STRUCT__entry
352 #define TP_STRUCT__entry(args...) args
353
354 #undef DECLARE_EVENT_CLASS
355 #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
356 static inline size_t __event_get_size__##_name(size_t *__dynamic_len, _proto) \
357 { \
358 size_t __event_len = 0; \
359 unsigned int __dynamic_len_idx = 0; \
360 \
361 if (0) \
362 (void) __dynamic_len_idx; /* don't warn if unused */ \
363 _tstruct \
364 return __event_len; \
365 }
366
367 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
368
369 /*
370 * Stage 7 of the trace events.
371 *
372 * Create static inline function that calculates event payload alignment.
373 */
374
375 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
376
377 /* Named field types must be defined in lttng-types.h */
378
379 #undef __field_full
380 #define __field_full(_type, _item, _order, _base) \
381 __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
382
383 #undef __array_enc_ext
384 #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) \
385 __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
386
387 #undef __dynamic_array_enc_ext
388 #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
389 __event_align = max_t(size_t, __event_align, ltt_alignof(u32)); \
390 __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
391
392 #undef __string
393 #define __string(_item, _src)
394
395 #undef __string_from_user
396 #define __string_from_user(_item, _src)
397
398 #undef TP_PROTO
399 #define TP_PROTO(args...) args
400
401 #undef TP_STRUCT__entry
402 #define TP_STRUCT__entry(args...) args
403
404 #undef DECLARE_EVENT_CLASS
405 #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
406 static inline size_t __event_get_align__##_name(_proto) \
407 { \
408 size_t __event_align = 1; \
409 _tstruct \
410 return __event_align; \
411 }
412
413 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
414
415
416 /*
417 * Stage 8 of the trace events.
418 *
419 * Create structure declaration that allows the "assign" macros to access the
420 * field types.
421 */
422
423 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
424
425 /* Named field types must be defined in lttng-types.h */
426
427 #undef __field_full
428 #define __field_full(_type, _item, _order, _base) _type _item;
429
430 #undef __array_enc_ext
431 #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) \
432 _type _item;
433
434 #undef __dynamic_array_enc_ext
435 #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
436 _type _item;
437
438 #undef __string
439 #define __string(_item, _src) char _item;
440
441 #undef __string_from_user
442 #define __string_from_user(_item, _src) \
443 __string(_item, _src)
444
445 #undef TP_STRUCT__entry
446 #define TP_STRUCT__entry(args...) args
447
448 #undef DECLARE_EVENT_CLASS
449 #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
450 struct __event_typemap__##_name { \
451 _tstruct \
452 };
453
454 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
455
456
457 /*
458 * Stage 9 of the trace events.
459 *
460 * Create the probe function : call even size calculation and write event data
461 * into the buffer.
462 *
463 * We use both the field and assignment macros to write the fields in the order
464 * defined in the field declaration. The field declarations control the
465 * execution order, jumping to the appropriate assignment block.
466 */
467
468 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
469
470 #undef __field_full
471 #define __field_full(_type, _item, _order, _base) \
472 goto __assign_##_item; \
473 __end_field_##_item:
474
475 #undef __array_enc_ext
476 #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
477 goto __assign_##_item; \
478 __end_field_##_item:
479
480 #undef __dynamic_array_enc_ext
481 #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
482 goto __assign_##_item##_1; \
483 __end_field_##_item##_1: \
484 goto __assign_##_item##_2; \
485 __end_field_##_item##_2:
486
487 #undef __string
488 #define __string(_item, _src) \
489 goto __assign_##_item; \
490 __end_field_##_item:
491
492 #undef __string_from_user
493 #define __string_from_user(_item, _src) \
494 __string(_item, _src)
495
496 /*
497 * Macros mapping tp_assign() to "=", tp_memcpy() to memcpy() and tp_strcpy() to
498 * strcpy().
499 */
500 #undef tp_assign
501 #define tp_assign(dest, src) \
502 __assign_##dest: \
503 { \
504 __typeof__(__typemap.dest) __tmp = (src); \
505 lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(__tmp)); \
506 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
507 } \
508 goto __end_field_##dest;
509
510 #undef tp_memcpy
511 #define tp_memcpy(dest, src, len) \
512 __assign_##dest: \
513 if (0) \
514 (void) __typemap.dest; \
515 lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(__typemap.dest)); \
516 __chan->ops->event_write(&__ctx, src, len); \
517 goto __end_field_##dest;
518
519 #undef tp_memcpy_dyn
520 #define tp_memcpy_dyn(dest, src) \
521 __assign_##dest##_1: \
522 { \
523 u32 __tmpl = __dynamic_len[__dynamic_len_idx]; \
524 lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(u32)); \
525 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(u32)); \
526 } \
527 goto __end_field_##dest##_1; \
528 __assign_##dest##_2: \
529 lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(__typemap.dest)); \
530 __chan->ops->event_write(&__ctx, src, \
531 sizeof(__typemap.dest) * __get_dynamic_array_len(dest));\
532 goto __end_field_##dest##_2;
533
534 #undef tp_memcpy_from_user
535 #define tp_memcpy_from_user(dest, src, len) \
536 __assign_##dest: \
537 if (0) \
538 (void) __typemap.dest; \
539 lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(__typemap.dest)); \
540 __chan->ops->event_write_from_user(&__ctx, src, len); \
541 goto __end_field_##dest;
542
543 #undef tp_copy_string_from_user
544 #define tp_copy_string_from_user(dest, src) \
545 __assign_##dest: \
546 if (0) \
547 (void) __typemap.dest; \
548 lib_ring_buffer_align_ctx(&__ctx, ltt_alignof(__typemap.dest)); \
549 __chan->ops->event_write_from_user(&__ctx, src, \
550 __get_dynamic_array_len(dest) - 1); \
551 __chan->ops->event_memset(&__ctx, 0, 1); \
552 goto __end_field_##dest;
553
554 #undef tp_strcpy
555 #define tp_strcpy(dest, src) \
556 tp_memcpy(dest, src, __get_dynamic_array_len(dest))
557
558 /* Named field types must be defined in lttng-types.h */
559
560 #undef __get_str
561 #define __get_str(field) field
562
563 #undef __get_dynamic_array
564 #define __get_dynamic_array(field) field
565
566 /* Beware: this get len actually consumes the len value */
567 #undef __get_dynamic_array_len
568 #define __get_dynamic_array_len(field) __dynamic_len[__dynamic_len_idx++]
569
570 #undef TP_PROTO
571 #define TP_PROTO(args...) args
572
573 #undef TP_ARGS
574 #define TP_ARGS(args...) args
575
576 #undef TP_STRUCT__entry
577 #define TP_STRUCT__entry(args...) args
578
579 #undef TP_fast_assign
580 #define TP_fast_assign(args...) args
581
582 #undef DECLARE_EVENT_CLASS
583 #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
584 static void __event_probe__##_name(void *__data, _proto) \
585 { \
586 struct ltt_event *__event = __data; \
587 struct ltt_channel *__chan = __event->chan; \
588 struct lib_ring_buffer_ctx __ctx; \
589 size_t __event_len, __event_align; \
590 size_t __dynamic_len_idx = 0; \
591 size_t __dynamic_len[ARRAY_SIZE(__event_fields___##_name)]; \
592 struct __event_typemap__##_name __typemap; \
593 int __ret; \
594 \
595 if (0) \
596 (void) __dynamic_len_idx; /* don't warn if unused */ \
597 if (unlikely(!ACCESS_ONCE(__chan->session->active))) \
598 return; \
599 if (unlikely(!ACCESS_ONCE(__chan->enabled))) \
600 return; \
601 if (unlikely(!ACCESS_ONCE(__event->enabled))) \
602 return; \
603 __event_len = __event_get_size__##_name(__dynamic_len, _args); \
604 __event_align = __event_get_align__##_name(_args); \
605 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
606 __event_align, -1); \
607 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
608 if (__ret < 0) \
609 return; \
610 /* Control code (field ordering) */ \
611 _tstruct \
612 __chan->ops->event_commit(&__ctx); \
613 return; \
614 /* Copy code, steered by control code */ \
615 _assign \
616 }
617
618 #undef DECLARE_EVENT_CLASS_NOARGS
619 #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
620 static void __event_probe__##_name(void *__data) \
621 { \
622 struct ltt_event *__event = __data; \
623 struct ltt_channel *__chan = __event->chan; \
624 struct lib_ring_buffer_ctx __ctx; \
625 size_t __event_len, __event_align; \
626 int __ret; \
627 \
628 if (unlikely(!ACCESS_ONCE(__chan->session->active))) \
629 return; \
630 if (unlikely(!ACCESS_ONCE(__chan->enabled))) \
631 return; \
632 if (unlikely(!ACCESS_ONCE(__event->enabled))) \
633 return; \
634 __event_len = 0; \
635 __event_align = 1; \
636 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
637 __event_align, -1); \
638 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
639 if (__ret < 0) \
640 return; \
641 /* Control code (field ordering) */ \
642 _tstruct \
643 __chan->ops->event_commit(&__ctx); \
644 return; \
645 /* Copy code, steered by control code */ \
646 _assign \
647 }
648
649 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
650
651 /*
652 * Stage 10 of the trace events.
653 *
654 * Register/unregister probes at module load/unload.
655 */
656
657 #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
658
659 #define TP_ID1(_token, _system) _token##_system
660 #define TP_ID(_token, _system) TP_ID1(_token, _system)
661 #define module_init_eval1(_token, _system) module_init(_token##_system)
662 #define module_init_eval(_token, _system) module_init_eval1(_token, _system)
663 #define module_exit_eval1(_token, _system) module_exit(_token##_system)
664 #define module_exit_eval(_token, _system) module_exit_eval1(_token, _system)
665
666 #ifndef TP_MODULE_OVERRIDE
667 static int TP_ID(__lttng_events_init__, TRACE_SYSTEM)(void)
668 {
669 wrapper_vmalloc_sync_all();
670 return ltt_probe_register(&TP_ID(__probe_desc___, TRACE_SYSTEM));
671 }
672
673 module_init_eval(__lttng_events_init__, TRACE_SYSTEM);
674
675 static void TP_ID(__lttng_events_exit__, TRACE_SYSTEM)(void)
676 {
677 ltt_probe_unregister(&TP_ID(__probe_desc___, TRACE_SYSTEM));
678 }
679
680 module_exit_eval(__lttng_events_exit__, TRACE_SYSTEM);
681 #endif
682
683 #undef module_init_eval
684 #undef module_exit_eval
685 #undef TP_ID1
686 #undef TP_ID
687
688 #undef TP_PROTO
689 #undef TP_ARGS
690 #undef TRACE_EVENT_FLAGS
This page took 0.055655 seconds and 4 git commands to generate.