Make lttng-ust robust against -finstrument-functions.
[lttng-ust.git] / include / lttng / ust-tracepoint-event.h
1 /*
2 * Copyright (c) 2011-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 */
14
15 #include <stdio.h>
16 #include <urcu/compiler.h>
17 #include <lttng/ust-events.h>
18 #include <lttng/ringbuffer-config.h>
19 #include <lttng/ust-compiler.h>
20 #include <string.h>
21
22 /*
23 * TRACEPOINT_EVENT_CLASS declares a class of tracepoints receiving the
24 * same arguments and having the same field layout.
25 *
26 * TRACEPOINT_EVENT_INSTANCE declares an instance of a tracepoint, with
27 * its own provider and name. It refers to a class (template).
28 *
29 * TRACEPOINT_EVENT declared both a class and an instance and does a
30 * direct mapping from the instance to the class.
31 */
32
33 #undef TRACEPOINT_EVENT
34 #define TRACEPOINT_EVENT(_provider, _name, _args, _fields) \
35 TRACEPOINT_EVENT_CLASS(_provider, _name, \
36 _TP_PARAMS(_args), \
37 _TP_PARAMS(_fields)) \
38 TRACEPOINT_EVENT_INSTANCE(_provider, _name, _name, \
39 _TP_PARAMS(_args))
40
41 /* Helpers */
42 #define _TP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
43
44 #define _tp_max_t(type, x, y) \
45 ({ \
46 type __max1 = (x); \
47 type __max2 = (y); \
48 __max1 > __max2 ? __max1: __max2; \
49 })
50
51 /*
52 * Stage 0 of tracepoint event generation.
53 *
54 * Check that each TRACEPOINT_EVENT provider argument match the
55 * TRACEPOINT_PROVIDER by creating dummy callbacks.
56 */
57
58 /* Reset all macros within TRACEPOINT_EVENT */
59 #include <lttng/ust-tracepoint-event-reset.h>
60
61 static inline
62 void _TP_COMBINE_TOKENS(__tracepoint_provider_mismatch_, TRACEPOINT_PROVIDER)(void)
63 {
64 }
65
66 #undef TRACEPOINT_EVENT_CLASS
67 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
68 __tracepoint_provider_mismatch_##_provider();
69
70 #undef TRACEPOINT_EVENT_INSTANCE
71 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
72 __tracepoint_provider_mismatch_##_provider();
73
74 static __attribute__((unused))
75 void _TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void)
76 {
77 #include TRACEPOINT_INCLUDE
78 }
79
80 /*
81 * Stage 0.1 of tracepoint event generation.
82 *
83 * Check that each TRACEPOINT_EVENT provider:name does not exceed the
84 * tracepoint name length limit.
85 */
86
87 /* Reset all macros within TRACEPOINT_EVENT */
88 #include <lttng/ust-tracepoint-event-reset.h>
89
90 #undef TRACEPOINT_EVENT_INSTANCE
91 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
92 static const char \
93 __tp_name_len_check##_provider##___##_name[LTTNG_UST_SYM_NAME_LEN] \
94 __attribute__((unused)) = \
95 #_provider ":" #_name;
96
97 #include TRACEPOINT_INCLUDE
98
99 /*
100 * Stage 1 of tracepoint event generation.
101 *
102 * Create event field type metadata section.
103 * Each event produce an array of fields.
104 */
105
106 /* Reset all macros within TRACEPOINT_EVENT */
107 #include <lttng/ust-tracepoint-event-reset.h>
108 #include <lttng/ust-tracepoint-event-write.h>
109 #include <lttng/ust-tracepoint-event-nowrite.h>
110
111 #undef _ctf_integer_ext
112 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
113 { \
114 .name = #_item, \
115 .type = __type_integer(_type, _byte_order, _base, none),\
116 .written = _written, \
117 },
118
119 #undef _ctf_float
120 #define _ctf_float(_type, _item, _src, _written) \
121 { \
122 .name = #_item, \
123 .type = __type_float(_type), \
124 .written = _written, \
125 },
126
127 #undef _ctf_array_encoded
128 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
129 { \
130 .name = #_item, \
131 .type = \
132 { \
133 .atype = atype_array, \
134 .u.array = \
135 { \
136 .length = _length, \
137 .elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \
138 }, \
139 }, \
140 .written = _written, \
141 },
142
143 #undef _ctf_sequence_encoded
144 #define _ctf_sequence_encoded(_type, _item, _src, \
145 _length_type, _src_length, _encoding, _written) \
146 { \
147 .name = #_item, \
148 .type = \
149 { \
150 .atype = atype_sequence, \
151 .u.sequence = \
152 { \
153 .length_type = __type_integer(_length_type, BYTE_ORDER, 10, none), \
154 .elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \
155 }, \
156 }, \
157 .written = _written, \
158 },
159
160 #undef _ctf_string
161 #define _ctf_string(_item, _src, _written) \
162 { \
163 .name = #_item, \
164 .type = \
165 { \
166 .atype = atype_string, \
167 .u.basic.string.encoding = lttng_encode_UTF8, \
168 }, \
169 .written = _written, \
170 },
171
172 #undef TP_FIELDS
173 #define TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
174
175 #undef TRACEPOINT_EVENT_CLASS
176 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
177 static const struct lttng_event_field __event_fields___##_provider##___##_name[] = { \
178 _fields \
179 };
180
181 #include TRACEPOINT_INCLUDE
182
183 /*
184 * Stage 2 of tracepoint event generation.
185 *
186 * Create probe callback prototypes.
187 */
188
189 /* Reset all macros within TRACEPOINT_EVENT */
190 #include <lttng/ust-tracepoint-event-reset.h>
191
192 #undef TP_ARGS
193 #define TP_ARGS(...) __VA_ARGS__
194
195 #undef TRACEPOINT_EVENT_CLASS
196 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
197 static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args));
198
199 #include TRACEPOINT_INCLUDE
200
201 /*
202 * Stage 3 of tracepoint event generation.
203 *
204 * Create static inline function that calculates event size.
205 */
206
207 /* Reset all macros within TRACEPOINT_EVENT */
208 #include <lttng/ust-tracepoint-event-reset.h>
209 #include <lttng/ust-tracepoint-event-write.h>
210
211 #undef _ctf_integer_ext
212 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
213 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
214 __event_len += sizeof(_type);
215
216 #undef _ctf_float
217 #define _ctf_float(_type, _item, _src, _written) \
218 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
219 __event_len += sizeof(_type);
220
221 #undef _ctf_array_encoded
222 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
223 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
224 __event_len += sizeof(_type) * (_length);
225
226 #undef _ctf_sequence_encoded
227 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
228 _src_length, _encoding, _written) \
229 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \
230 __event_len += sizeof(_length_type); \
231 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
232 __dynamic_len[__dynamic_len_idx] = (_src_length); \
233 __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \
234 __dynamic_len_idx++;
235
236 #undef _ctf_string
237 #define _ctf_string(_item, _src, _written) \
238 __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1;
239
240 #undef TP_ARGS
241 #define TP_ARGS(...) __VA_ARGS__
242
243 #undef TP_FIELDS
244 #define TP_FIELDS(...) __VA_ARGS__
245
246 #undef TRACEPOINT_EVENT_CLASS
247 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
248 static inline lttng_ust_notrace \
249 size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)); \
250 static inline \
251 size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \
252 { \
253 size_t __event_len = 0; \
254 unsigned int __dynamic_len_idx = 0; \
255 \
256 if (0) \
257 (void) __dynamic_len_idx; /* don't warn if unused */ \
258 _fields \
259 return __event_len; \
260 }
261
262 #include TRACEPOINT_INCLUDE
263
264 /*
265 * Stage 3.1 of tracepoint event generation.
266 *
267 * Create static inline function that layout the filter stack data.
268 * We make both write and nowrite data available to the filter.
269 */
270
271 /* Reset all macros within TRACEPOINT_EVENT */
272 #include <lttng/ust-tracepoint-event-reset.h>
273 #include <lttng/ust-tracepoint-event-write.h>
274 #include <lttng/ust-tracepoint-event-nowrite.h>
275
276 #undef _ctf_integer_ext
277 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
278 if (lttng_is_signed_type(_type)) \
279 *(int64_t *) __stack_data = (int64_t) (_type) (_src); \
280 else \
281 *(uint64_t *) __stack_data = (uint64_t) (_type) (_src); \
282 __stack_data += sizeof(int64_t);
283
284 #undef _ctf_float
285 #define _ctf_float(_type, _item, _src, _written) \
286 *(double *) __stack_data = (double) (_type) (_src); \
287 __stack_data += sizeof(double);
288
289 #undef _ctf_array_encoded
290 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
291 *(unsigned long *) __stack_data = (unsigned long) (_length); \
292 __stack_data += sizeof(unsigned long); \
293 *(const void **) __stack_data = (_src); \
294 __stack_data += sizeof(void *);
295
296 #undef _ctf_sequence_encoded
297 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
298 _src_length, _encoding, _written) \
299 *(unsigned long *) __stack_data = (unsigned long) (_src_length); \
300 __stack_data += sizeof(unsigned long); \
301 *(const void **) __stack_data = (_src); \
302 __stack_data += sizeof(void *);
303
304 #undef _ctf_string
305 #define _ctf_string(_item, _src, _written) \
306 *(const void **) __stack_data = (_src); \
307 __stack_data += sizeof(void *);
308
309 #undef TP_ARGS
310 #define TP_ARGS(...) __VA_ARGS__
311
312 #undef TP_FIELDS
313 #define TP_FIELDS(...) __VA_ARGS__
314
315 #undef TRACEPOINT_EVENT_CLASS
316 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
317 static inline \
318 void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\
319 _TP_ARGS_DATA_PROTO(_args)) \
320 { \
321 _fields \
322 }
323
324 #include TRACEPOINT_INCLUDE
325
326
327
328 /*
329 * Stage 4 of tracepoint event generation.
330 *
331 * Create static inline function that calculates event payload alignment.
332 */
333
334 /* Reset all macros within TRACEPOINT_EVENT */
335 #include <lttng/ust-tracepoint-event-reset.h>
336 #include <lttng/ust-tracepoint-event-write.h>
337
338 #undef _ctf_integer_ext
339 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
340 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
341
342 #undef _ctf_float
343 #define _ctf_float(_type, _item, _src, _written) \
344 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
345
346 #undef _ctf_array_encoded
347 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
348 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
349
350 #undef _ctf_sequence_encoded
351 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
352 _src_length, _encoding, _written) \
353 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_length_type)); \
354 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
355
356 #undef _ctf_string
357 #define _ctf_string(_item, _src, _written)
358
359 #undef TP_ARGS
360 #define TP_ARGS(...) __VA_ARGS__
361
362 #undef TP_FIELDS
363 #define TP_FIELDS(...) __VA_ARGS__
364
365 #undef TRACEPOINT_EVENT_CLASS
366 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
367 static inline lttng_ust_notrace \
368 size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)); \
369 static inline \
370 size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \
371 { \
372 size_t __event_align = 1; \
373 _fields \
374 return __event_align; \
375 }
376
377 #include TRACEPOINT_INCLUDE
378
379
380 /*
381 * Stage 5 of tracepoint event generation.
382 *
383 * Create the probe function. This function calls event size calculation
384 * and writes event data into the buffer.
385 */
386
387 /* Reset all macros within TRACEPOINT_EVENT */
388 #include <lttng/ust-tracepoint-event-reset.h>
389 #include <lttng/ust-tracepoint-event-write.h>
390
391 #undef _ctf_integer_ext
392 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
393 { \
394 _type __tmp = (_src); \
395 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
396 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
397 }
398
399 #undef _ctf_float
400 #define _ctf_float(_type, _item, _src, _written) \
401 { \
402 _type __tmp = (_src); \
403 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
404 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
405 }
406
407 #undef _ctf_array_encoded
408 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
409 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
410 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length));
411
412 #undef _ctf_sequence_encoded
413 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
414 _src_length, _encoding, _written) \
415 { \
416 _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \
417 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
418 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
419 } \
420 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
421 __chan->ops->event_write(&__ctx, _src, \
422 sizeof(_type) * __get_dynamic_len(dest));
423
424 #undef _ctf_string
425 #define _ctf_string(_item, _src, _written) \
426 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
427 __chan->ops->event_write(&__ctx, _src, __get_dynamic_len(dest));
428
429 /* Beware: this get len actually consumes the len value */
430 #undef __get_dynamic_len
431 #define __get_dynamic_len(field) __stackvar.__dynamic_len[__dynamic_len_idx++]
432
433 #undef TP_ARGS
434 #define TP_ARGS(...) __VA_ARGS__
435
436 #undef TP_FIELDS
437 #define TP_FIELDS(...) __VA_ARGS__
438
439 /*
440 * Using twice size for filter stack data to hold size and pointer for
441 * each field (worse case). For integers, max size required is 64-bit.
442 * Same for double-precision floats. Those fit within
443 * 2*sizeof(unsigned long) for all supported architectures.
444 */
445 #undef TRACEPOINT_EVENT_CLASS
446 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
447 static lttng_ust_notrace \
448 void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); \
449 static \
450 void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \
451 { \
452 struct ltt_event *__event = __tp_data; \
453 struct ltt_channel *__chan = __event->chan; \
454 struct lttng_ust_lib_ring_buffer_ctx __ctx; \
455 size_t __event_len, __event_align; \
456 size_t __dynamic_len_idx = 0; \
457 union { \
458 size_t __dynamic_len[_TP_ARRAY_SIZE(__event_fields___##_provider##___##_name)]; \
459 char __filter_stack_data[2 * sizeof(unsigned long) * _TP_ARRAY_SIZE(__event_fields___##_provider##___##_name)]; \
460 } __stackvar; \
461 int __ret; \
462 \
463 if (0) \
464 (void) __dynamic_len_idx; /* don't warn if unused */ \
465 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->session->active))) \
466 return; \
467 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->enabled))) \
468 return; \
469 if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled))) \
470 return; \
471 if (caa_unlikely(__event->filter)) { \
472 __event_prepare_filter_stack__##_provider##___##_name(__stackvar.__filter_stack_data, \
473 _TP_ARGS_DATA_VAR(_args)); \
474 if (caa_likely(!__event->filter(__event->filter_data, __stackvar.__filter_stack_data))) \
475 return; \
476 } \
477 __event_len = __event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \
478 _TP_ARGS_DATA_VAR(_args)); \
479 __event_align = __event_get_align__##_provider##___##_name(_TP_ARGS_VAR(_args)); \
480 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
481 __event_align, -1, __chan->handle); \
482 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
483 if (__ret < 0) \
484 return; \
485 _fields \
486 __chan->ops->event_commit(&__ctx); \
487 }
488
489 #include TRACEPOINT_INCLUDE
490
491 #undef __get_dynamic_len
492
493 /*
494 * Stage 5.1 of tracepoint event generation.
495 *
496 * Create probe signature
497 */
498
499 /* Reset all macros within TRACEPOINT_EVENT */
500 #include <lttng/ust-tracepoint-event-reset.h>
501
502 #undef TP_ARGS
503 #define TP_ARGS(...) __VA_ARGS__
504
505 #define _TP_EXTRACT_STRING2(...) #__VA_ARGS__
506
507 #undef TRACEPOINT_EVENT_CLASS
508 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
509 const char __tp_event_signature___##_provider##___##_name[] = \
510 _TP_EXTRACT_STRING2(_args);
511
512 #include TRACEPOINT_INCLUDE
513
514 #undef _TP_EXTRACT_STRING2
515
516 /*
517 * Stage 6 of tracepoint event generation.
518 *
519 * Tracepoint loglevel mapping definition generation. We generate a
520 * symbol for each mapping for a provider/event to ensure at most a 1 to
521 * 1 mapping between events and loglevels. If the symbol is repeated,
522 * the compiler will complain.
523 */
524
525 /* Reset all macros within TRACEPOINT_EVENT */
526 #include <lttng/ust-tracepoint-event-reset.h>
527
528 #undef TRACEPOINT_LOGLEVEL
529 #define TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \
530 static const int _loglevel_value___##__provider##___##__name = __loglevel; \
531 static const int *_loglevel___##__provider##___##__name = \
532 &_loglevel_value___##__provider##___##__name;
533
534 #include TRACEPOINT_INCLUDE
535
536 /*
537 * Stage 7.1 of tracepoint event generation.
538 *
539 * Create events description structures. We use a weakref because
540 * loglevels are optional. If not declared, the event will point to the
541 * a loglevel that contains NULL.
542 */
543
544 /* Reset all macros within TRACEPOINT_EVENT */
545 #include <lttng/ust-tracepoint-event-reset.h>
546
547 #undef TRACEPOINT_EVENT_INSTANCE
548 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
549 static const int * \
550 __ref_loglevel___##_provider##___##_name \
551 __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \
552 const struct lttng_event_desc __event_desc___##_provider##_##_name = { \
553 .fields = __event_fields___##_provider##___##_template, \
554 .name = #_provider ":" #_name, \
555 .probe_callback = (void (*)(void)) &__event_probe__##_provider##___##_template,\
556 .nr_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_template), \
557 .loglevel = &__ref_loglevel___##_provider##___##_name, \
558 .signature = __tp_event_signature___##_provider##___##_template, \
559 };
560
561 #include TRACEPOINT_INCLUDE
562
563 /*
564 * Stage 7.2 of tracepoint event generation.
565 *
566 * Create array of events.
567 */
568
569 /* Reset all macros within TRACEPOINT_EVENT */
570 #include <lttng/ust-tracepoint-event-reset.h>
571
572 #undef TRACEPOINT_EVENT_INSTANCE
573 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
574 &__event_desc___##_provider##_##_name,
575
576 static const struct lttng_event_desc *_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = {
577 #include TRACEPOINT_INCLUDE
578 };
579
580
581 /*
582 * Stage 8 of tracepoint event generation.
583 *
584 * Create a toplevel descriptor for the whole probe.
585 */
586
587 /* non-const because list head will be modified when registered. */
588 static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER) = {
589 .provider = __tp_stringify(TRACEPOINT_PROVIDER),
590 .event_desc = _TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER),
591 .nr_events = _TP_ARRAY_SIZE(_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)),
592 };
593
594 /*
595 * Stage 9 of tracepoint event generation.
596 *
597 * Register/unregister probes at module load/unload.
598 *
599 * Generate the constructor as an externally visible symbol for use when
600 * linking the probe statically.
601 */
602
603 /* Reset all macros within TRACEPOINT_EVENT */
604 #include <lttng/ust-tracepoint-event-reset.h>
605 static void lttng_ust_notrace __attribute__((constructor))
606 _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void);
607 static void
608 _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void)
609 {
610 int ret;
611
612 ret = ltt_probe_register(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
613 assert(!ret);
614 }
615
616 static void lttng_ust_notrace __attribute__((destructor))
617 _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void);
618 static void
619 _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void)
620 {
621 ltt_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
622 }
623
624 int _TP_COMBINE_TOKENS(__tracepoint_provider_, TRACEPOINT_PROVIDER);
This page took 0.04114 seconds and 5 git commands to generate.