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