2 * Copyright (c) 2011-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 #include <urcu/compiler.h>
25 #include <urcu/rculist.h>
26 #include <lttng/ust-events.h>
27 #include <lttng/ringbuffer-config.h>
28 #include <lttng/ust-compiler.h>
29 #include <lttng/tracepoint.h>
32 #undef tp_list_for_each_entry_rcu
33 #define tp_list_for_each_entry_rcu(pos, head, member) \
34 for (pos = cds_list_entry(tp_rcu_dereference_bp((head)->next), __typeof__(*pos), member); \
35 &pos->member != (head); \
36 pos = cds_list_entry(tp_rcu_dereference_bp(pos->member.next), __typeof__(*pos), member))
39 * TRACEPOINT_EVENT_CLASS declares a class of tracepoints receiving the
40 * same arguments and having the same field layout.
42 * TRACEPOINT_EVENT_INSTANCE declares an instance of a tracepoint, with
43 * its own provider and name. It refers to a class (template).
45 * TRACEPOINT_EVENT declared both a class and an instance and does a
46 * direct mapping from the instance to the class.
49 #undef TRACEPOINT_EVENT
50 #define TRACEPOINT_EVENT(_provider, _name, _args, _fields) \
51 TRACEPOINT_EVENT_CLASS(_provider, _name, \
53 _TP_PARAMS(_fields)) \
54 TRACEPOINT_EVENT_INSTANCE(_provider, _name, _name, \
58 #define _TP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
60 #define _tp_max_t(type, x, y) \
64 __max1 > __max2 ? __max1: __max2; \
68 * Stage 0 of tracepoint event generation.
70 * Check that each TRACEPOINT_EVENT provider argument match the
71 * TRACEPOINT_PROVIDER by creating dummy callbacks.
74 /* Reset all macros within TRACEPOINT_EVENT */
75 #include <lttng/ust-tracepoint-event-reset.h>
78 void _TP_COMBINE_TOKENS(__tracepoint_provider_mismatch_
, TRACEPOINT_PROVIDER
)(void)
82 #undef TRACEPOINT_EVENT_CLASS
83 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
84 __tracepoint_provider_mismatch_##_provider();
86 #undef TRACEPOINT_EVENT_INSTANCE
87 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
88 __tracepoint_provider_mismatch_##_provider();
91 void _TP_COMBINE_TOKENS(__tracepoint_provider_check_
, TRACEPOINT_PROVIDER
)(void)
93 #include TRACEPOINT_INCLUDE
97 * Stage 0.1 of tracepoint event generation.
99 * Check that each TRACEPOINT_EVENT provider:name does not exceed the
100 * tracepoint name length limit.
103 /* Reset all macros within TRACEPOINT_EVENT */
104 #include <lttng/ust-tracepoint-event-reset.h>
106 #undef TRACEPOINT_EVENT_INSTANCE
107 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
109 __tp_name_len_check##_provider##___##_name[LTTNG_UST_SYM_NAME_LEN] \
110 __attribute__((unused)) = \
111 #_provider ":" #_name;
113 #include TRACEPOINT_INCLUDE
116 * Stage 1 of tracepoint event generation.
118 * Create event field type metadata section.
119 * Each event produce an array of fields.
122 /* Reset all macros within TRACEPOINT_EVENT */
123 #include <lttng/ust-tracepoint-event-reset.h>
124 #include <lttng/ust-tracepoint-event-write.h>
125 #include <lttng/ust-tracepoint-event-nowrite.h>
127 #undef _ctf_integer_ext
128 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
131 .type = __type_integer(_type, _byte_order, _base, none),\
132 .nowrite = _nowrite, \
136 #define _ctf_float(_type, _item, _src, _nowrite) \
139 .type = __type_float(_type), \
140 .nowrite = _nowrite, \
143 #undef _ctf_array_encoded
144 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite) \
149 .atype = atype_array, \
154 .elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \
159 .nowrite = _nowrite, \
162 #undef _ctf_sequence_encoded
163 #define _ctf_sequence_encoded(_type, _item, _src, \
164 _length_type, _src_length, _encoding, _nowrite) \
169 .atype = atype_sequence, \
174 .length_type = __type_integer(_length_type, BYTE_ORDER, 10, none), \
175 .elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \
179 .nowrite = _nowrite, \
183 #define _ctf_string(_item, _src, _nowrite) \
188 .atype = atype_string, \
191 .basic = { .string = { .encoding = lttng_encode_UTF8 } } \
194 .nowrite = _nowrite, \
198 #define TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
200 #undef TRACEPOINT_EVENT_CLASS
201 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
202 static const struct lttng_event_field __event_fields___##_provider##___##_name[] = { \
206 #include TRACEPOINT_INCLUDE
209 * Stage 2 of tracepoint event generation.
211 * Create probe callback prototypes.
214 /* Reset all macros within TRACEPOINT_EVENT */
215 #include <lttng/ust-tracepoint-event-reset.h>
218 #define TP_ARGS(...) __VA_ARGS__
220 #undef TRACEPOINT_EVENT_CLASS
221 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
222 static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args));
224 #include TRACEPOINT_INCLUDE
227 * Stage 3 of tracepoint event generation.
229 * Create static inline function that calculates event size.
232 /* Reset all macros within TRACEPOINT_EVENT */
233 #include <lttng/ust-tracepoint-event-reset.h>
234 #include <lttng/ust-tracepoint-event-write.h>
236 #undef _ctf_integer_ext
237 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
238 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
239 __event_len += sizeof(_type);
242 #define _ctf_float(_type, _item, _src, _nowrite) \
243 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
244 __event_len += sizeof(_type);
246 #undef _ctf_array_encoded
247 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite) \
248 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
249 __event_len += sizeof(_type) * (_length);
251 #undef _ctf_sequence_encoded
252 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
253 _src_length, _encoding, _nowrite) \
254 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \
255 __event_len += sizeof(_length_type); \
256 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
257 __dynamic_len[__dynamic_len_idx] = (_src_length); \
258 __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \
262 #define _ctf_string(_item, _src, _nowrite) \
263 __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1;
266 #define TP_ARGS(...) __VA_ARGS__
269 #define TP_FIELDS(...) __VA_ARGS__
271 #undef TRACEPOINT_EVENT_CLASS
272 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
273 static inline lttng_ust_notrace \
274 size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)); \
276 size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \
278 size_t __event_len = 0; \
279 unsigned int __dynamic_len_idx = 0; \
282 (void) __dynamic_len_idx; /* don't warn if unused */ \
284 return __event_len; \
287 #include TRACEPOINT_INCLUDE
290 * Stage 3.1 of tracepoint event generation.
292 * Create static inline function that layout the filter stack data.
293 * We make both write and nowrite data available to the filter.
296 /* Reset all macros within TRACEPOINT_EVENT */
297 #include <lttng/ust-tracepoint-event-reset.h>
298 #include <lttng/ust-tracepoint-event-write.h>
299 #include <lttng/ust-tracepoint-event-nowrite.h>
301 #undef _ctf_integer_ext
302 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
303 if (lttng_is_signed_type(_type)) { \
304 int64_t __ctf_tmp_int64 = (int64_t) (_type) (_src); \
305 memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t)); \
307 uint64_t __ctf_tmp_uint64 = (uint64_t) (_type) (_src); \
308 memcpy(__stack_data, &__ctf_tmp_uint64, sizeof(uint64_t)); \
310 __stack_data += sizeof(int64_t);
313 #define _ctf_float(_type, _item, _src, _nowrite) \
315 double __ctf_tmp_double = (double) (_type) (_src); \
316 memcpy(__stack_data, &__ctf_tmp_double, sizeof(double)); \
317 __stack_data += sizeof(double); \
320 #undef _ctf_array_encoded
321 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite) \
323 unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \
324 const void *__ctf_tmp_ptr = (_src); \
325 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
326 __stack_data += sizeof(unsigned long); \
327 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void **)); \
328 __stack_data += sizeof(void **); \
331 #undef _ctf_sequence_encoded
332 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
333 _src_length, _encoding, _nowrite) \
335 unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \
336 const void *__ctf_tmp_ptr = (_src); \
337 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
338 __stack_data += sizeof(unsigned long); \
339 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void **)); \
340 __stack_data += sizeof(void **); \
344 #define _ctf_string(_item, _src, _nowrite) \
346 const void *__ctf_tmp_ptr = (_src); \
347 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void **)); \
348 __stack_data += sizeof(void **); \
352 #define TP_ARGS(...) __VA_ARGS__
355 #define TP_FIELDS(...) __VA_ARGS__
357 #undef TRACEPOINT_EVENT_CLASS
358 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
360 void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\
361 _TP_ARGS_DATA_PROTO(_args)) \
366 #include TRACEPOINT_INCLUDE
371 * Stage 4 of tracepoint event generation.
373 * Create static inline function that calculates event payload alignment.
376 /* Reset all macros within TRACEPOINT_EVENT */
377 #include <lttng/ust-tracepoint-event-reset.h>
378 #include <lttng/ust-tracepoint-event-write.h>
380 #undef _ctf_integer_ext
381 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
382 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
385 #define _ctf_float(_type, _item, _src, _nowrite) \
386 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
388 #undef _ctf_array_encoded
389 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite) \
390 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
392 #undef _ctf_sequence_encoded
393 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
394 _src_length, _encoding, _nowrite) \
395 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_length_type)); \
396 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
399 #define _ctf_string(_item, _src, _nowrite)
402 #define TP_ARGS(...) __VA_ARGS__
405 #define TP_FIELDS(...) __VA_ARGS__
407 #undef TRACEPOINT_EVENT_CLASS
408 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
409 static inline lttng_ust_notrace \
410 size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)); \
412 size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \
414 size_t __event_align = 1; \
416 return __event_align; \
419 #include TRACEPOINT_INCLUDE
423 * Stage 5 of tracepoint event generation.
425 * Create the probe function. This function calls event size calculation
426 * and writes event data into the buffer.
429 /* Reset all macros within TRACEPOINT_EVENT */
430 #include <lttng/ust-tracepoint-event-reset.h>
431 #include <lttng/ust-tracepoint-event-write.h>
433 #undef _ctf_integer_ext
434 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
436 _type __tmp = (_src); \
437 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
438 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
442 #define _ctf_float(_type, _item, _src, _nowrite) \
444 _type __tmp = (_src); \
445 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
446 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
449 #undef _ctf_array_encoded
450 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _nowrite) \
451 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
452 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length));
454 #undef _ctf_sequence_encoded
455 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
456 _src_length, _encoding, _nowrite) \
458 _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \
459 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
460 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
462 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
463 __chan->ops->event_write(&__ctx, _src, \
464 sizeof(_type) * __get_dynamic_len(dest));
467 #define _ctf_string(_item, _src, _nowrite) \
468 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
469 __chan->ops->event_write(&__ctx, _src, __get_dynamic_len(dest));
471 /* Beware: this get len actually consumes the len value */
472 #undef __get_dynamic_len
473 #define __get_dynamic_len(field) __stackvar.__dynamic_len[__dynamic_len_idx++]
476 #define TP_ARGS(...) __VA_ARGS__
479 #define TP_FIELDS(...) __VA_ARGS__
482 * Using twice size for filter stack data to hold size and pointer for
483 * each field (worse case). For integers, max size required is 64-bit.
484 * Same for double-precision floats. Those fit within
485 * 2*sizeof(unsigned long) for all supported architectures.
486 * Perform UNION (||) of filter runtime list.
488 #undef TRACEPOINT_EVENT_CLASS
489 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
490 static lttng_ust_notrace \
491 void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); \
493 void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \
495 struct lttng_event *__event = (struct lttng_event *) __tp_data; \
496 struct lttng_channel *__chan = __event->chan; \
497 struct lttng_ust_lib_ring_buffer_ctx __ctx; \
498 size_t __event_len, __event_align; \
499 size_t __dynamic_len_idx = 0; \
501 size_t __dynamic_len[_TP_ARRAY_SIZE(__event_fields___##_provider##___##_name)]; \
502 char __filter_stack_data[2 * sizeof(unsigned long) * _TP_ARRAY_SIZE(__event_fields___##_provider##___##_name)]; \
507 (void) __dynamic_len_idx; /* don't warn if unused */ \
508 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->session->active))) \
510 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->enabled))) \
512 if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled))) \
514 if (caa_unlikely(!TP_RCU_LINK_TEST())) \
516 if (caa_unlikely(!cds_list_empty(&__event->bytecode_runtime_head))) { \
517 struct lttng_bytecode_runtime *bc_runtime; \
518 int __filter_record = __event->has_enablers_without_bytecode; \
520 __event_prepare_filter_stack__##_provider##___##_name(__stackvar.__filter_stack_data, \
521 _TP_ARGS_DATA_VAR(_args)); \
522 tp_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \
523 if (caa_unlikely(bc_runtime->filter(bc_runtime, \
524 __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \
525 __filter_record = 1; \
527 if (caa_likely(!__filter_record)) \
530 __event_len = __event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \
531 _TP_ARGS_DATA_VAR(_args)); \
532 __event_align = __event_get_align__##_provider##___##_name(_TP_ARGS_VAR(_args)); \
533 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
534 __event_align, -1, __chan->handle); \
535 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
539 __chan->ops->event_commit(&__ctx); \
542 #include TRACEPOINT_INCLUDE
544 #undef __get_dynamic_len
547 * Stage 5.1 of tracepoint event generation.
549 * Create probe signature
552 /* Reset all macros within TRACEPOINT_EVENT */
553 #include <lttng/ust-tracepoint-event-reset.h>
556 #define TP_ARGS(...) __VA_ARGS__
558 #define _TP_EXTRACT_STRING2(...) #__VA_ARGS__
560 #undef TRACEPOINT_EVENT_CLASS
561 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
562 const char __tp_event_signature___##_provider##___##_name[] = \
563 _TP_EXTRACT_STRING2(_args);
565 #include TRACEPOINT_INCLUDE
567 #undef _TP_EXTRACT_STRING2
570 * Stage 6 of tracepoint event generation.
572 * Tracepoint loglevel mapping definition generation. We generate a
573 * symbol for each mapping for a provider/event to ensure at most a 1 to
574 * 1 mapping between events and loglevels. If the symbol is repeated,
575 * the compiler will complain.
578 /* Reset all macros within TRACEPOINT_EVENT */
579 #include <lttng/ust-tracepoint-event-reset.h>
581 #undef TRACEPOINT_LOGLEVEL
582 #define TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \
583 static const int _loglevel_value___##__provider##___##__name = __loglevel; \
584 static const int *_loglevel___##__provider##___##__name = \
585 &_loglevel_value___##__provider##___##__name;
587 #include TRACEPOINT_INCLUDE
590 * Stage 6.1 of tracepoint event generation.
592 * Tracepoint UML URI info.
595 /* Reset all macros within TRACEPOINT_EVENT */
596 #include <lttng/ust-tracepoint-event-reset.h>
598 #undef TRACEPOINT_MODEL_EMF_URI
599 #define TRACEPOINT_MODEL_EMF_URI(__provider, __name, __uri) \
600 static const char *_model_emf_uri___##__provider##___##__name = __uri;
602 #include TRACEPOINT_INCLUDE
605 * Stage 7.1 of tracepoint event generation.
607 * Create events description structures. We use a weakref because
608 * loglevels are optional. If not declared, the event will point to the
609 * a loglevel that contains NULL.
612 /* Reset all macros within TRACEPOINT_EVENT */
613 #include <lttng/ust-tracepoint-event-reset.h>
615 #undef TRACEPOINT_EVENT_INSTANCE
616 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
618 __ref_loglevel___##_provider##___##_name \
619 __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \
620 static const char * \
621 __ref_model_emf_uri___##_provider##___##_name \
622 __attribute__((weakref ("_model_emf_uri___" #_provider "___" #_name)));\
623 const struct lttng_event_desc __event_desc___##_provider##_##_name = { \
624 .name = #_provider ":" #_name, \
625 .probe_callback = (void (*)(void)) &__event_probe__##_provider##___##_template,\
627 .fields = __event_fields___##_provider##___##_template, \
628 .nr_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_template), \
629 .loglevel = &__ref_loglevel___##_provider##___##_name, \
630 .signature = __tp_event_signature___##_provider##___##_template, \
631 .u = { .ext = { .model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name } }, \
634 #include TRACEPOINT_INCLUDE
637 * Stage 7.2 of tracepoint event generation.
639 * Create array of events.
642 /* Reset all macros within TRACEPOINT_EVENT */
643 #include <lttng/ust-tracepoint-event-reset.h>
645 #undef TRACEPOINT_EVENT_INSTANCE
646 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
647 &__event_desc___##_provider##_##_name,
649 static const struct lttng_event_desc
*_TP_COMBINE_TOKENS(__event_desc___
, TRACEPOINT_PROVIDER
)[] = {
650 #include TRACEPOINT_INCLUDE
655 * Stage 8 of tracepoint event generation.
657 * Create a toplevel descriptor for the whole probe.
660 /* non-const because list head will be modified when registered. */
661 static struct lttng_probe_desc
_TP_COMBINE_TOKENS(__probe_desc___
, TRACEPOINT_PROVIDER
) = {
662 .provider
= __tp_stringify(TRACEPOINT_PROVIDER
),
663 .event_desc
= _TP_COMBINE_TOKENS(__event_desc___
, TRACEPOINT_PROVIDER
),
664 .nr_events
= _TP_ARRAY_SIZE(_TP_COMBINE_TOKENS(__event_desc___
, TRACEPOINT_PROVIDER
)),
665 .head
= { NULL
, NULL
},
666 .lazy_init_head
= { NULL
, NULL
},
668 .major
= LTTNG_UST_PROVIDER_MAJOR
,
669 .minor
= LTTNG_UST_PROVIDER_MINOR
,
673 * Stage 9 of tracepoint event generation.
675 * Register/unregister probes at module load/unload.
677 * Generate the constructor as an externally visible symbol for use when
678 * linking the probe statically.
681 /* Reset all macros within TRACEPOINT_EVENT */
682 #include <lttng/ust-tracepoint-event-reset.h>
683 static void lttng_ust_notrace
__attribute__((constructor
))
684 _TP_COMBINE_TOKENS(__lttng_events_init__
, TRACEPOINT_PROVIDER
)(void);
686 _TP_COMBINE_TOKENS(__lttng_events_init__
, TRACEPOINT_PROVIDER
)(void)
691 * __tracepoint_provider_check_ ## TRACEPOINT_PROVIDER() is a
692 * static inline function that ensures every probe PROVIDER
693 * argument match the provider within which they appear. It
694 * calls empty static inline functions, and therefore has no
695 * runtime effect. However, if it detects an error, a linker
698 _TP_COMBINE_TOKENS(__tracepoint_provider_check_
, TRACEPOINT_PROVIDER
)();
699 ret
= lttng_probe_register(&_TP_COMBINE_TOKENS(__probe_desc___
, TRACEPOINT_PROVIDER
));
703 static void lttng_ust_notrace
__attribute__((destructor
))
704 _TP_COMBINE_TOKENS(__lttng_events_exit__
, TRACEPOINT_PROVIDER
)(void);
706 _TP_COMBINE_TOKENS(__lttng_events_exit__
, TRACEPOINT_PROVIDER
)(void)
708 lttng_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___
, TRACEPOINT_PROVIDER
));
711 int _TP_COMBINE_TOKENS(__tracepoint_provider_
, TRACEPOINT_PROVIDER
);