Filter: prepare filter stack data
[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 *(unsigned long *) __stack_data = (unsigned long) (strlen(_src) + 1); \
334 __stack_data += sizeof(unsigned long); \
335 *(const void **) __stack_data = (_src); \
336 __stack_data += sizeof(void *);
337
338 #undef TP_ARGS
339 #define TP_ARGS(...) __VA_ARGS__
340
341 #undef TP_FIELDS
342 #define TP_FIELDS(...) __VA_ARGS__
343
344 #undef TRACEPOINT_EVENT_CLASS
345 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
346 static inline \
347 void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\
348 _TP_ARGS_DATA_PROTO(_args)) \
349 { \
350 _fields \
351 }
352
353 #include TRACEPOINT_INCLUDE
354
355
356
357 /*
358 * Stage 4 of tracepoint event generation.
359 *
360 * Create static inline function that calculates event payload alignment.
361 */
362
363 /* Reset all macros within TRACEPOINT_EVENT */
364 #include <lttng/ust-tracepoint-event-reset.h>
365
366 #undef ctf_integer_ext
367 #define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \
368 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
369
370 #undef ctf_float
371 #define ctf_float(_type, _item, _src) \
372 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
373
374 #undef ctf_array_encoded
375 #define ctf_array_encoded(_type, _item, _src, _length, _encoding) \
376 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
377
378 #undef ctf_sequence_encoded
379 #define ctf_sequence_encoded(_type, _item, _src, _length_type, \
380 _src_length, _encoding) \
381 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_length_type)); \
382 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
383
384 #undef ctf_string
385 #define ctf_string(_item, _src)
386
387 #undef TP_ARGS
388 #define TP_ARGS(...) __VA_ARGS__
389
390 #undef TP_FIELDS
391 #define TP_FIELDS(...) __VA_ARGS__
392
393 #undef TRACEPOINT_EVENT_CLASS
394 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
395 static inline \
396 size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \
397 { \
398 size_t __event_align = 1; \
399 _fields \
400 return __event_align; \
401 }
402
403 #include TRACEPOINT_INCLUDE
404
405
406 /*
407 * Stage 5 of tracepoint event generation.
408 *
409 * Create the probe function. This function calls event size calculation
410 * and writes event data into the buffer.
411 */
412
413 /* Reset all macros within TRACEPOINT_EVENT */
414 #include <lttng/ust-tracepoint-event-reset.h>
415
416 #undef ctf_integer_ext
417 #define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \
418 { \
419 _type __tmp = (_src); \
420 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
421 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
422 }
423
424 #undef ctf_float
425 #define ctf_float(_type, _item, _src) \
426 { \
427 _type __tmp = (_src); \
428 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
429 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
430 }
431
432 #undef ctf_array_encoded
433 #define ctf_array_encoded(_type, _item, _src, _length, _encoding) \
434 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
435 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length));
436
437 #undef ctf_sequence_encoded
438 #define ctf_sequence_encoded(_type, _item, _src, _length_type, \
439 _src_length, _encoding) \
440 { \
441 _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \
442 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
443 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
444 } \
445 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
446 __chan->ops->event_write(&__ctx, _src, \
447 sizeof(_type) * __get_dynamic_len(dest));
448
449 #undef ctf_string
450 #define ctf_string(_item, _src) \
451 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
452 __chan->ops->event_write(&__ctx, _src, __get_dynamic_len(dest));
453
454 /* Beware: this get len actually consumes the len value */
455 #undef __get_dynamic_len
456 #define __get_dynamic_len(field) __stackvar.__dynamic_len[__dynamic_len_idx++]
457
458 #undef TP_ARGS
459 #define TP_ARGS(...) __VA_ARGS__
460
461 #undef TP_FIELDS
462 #define TP_FIELDS(...) __VA_ARGS__
463
464 /*
465 * Using twice size for filter stack data to hold size and pointer for
466 * each field (worse case). For integers, max size required is 64-bit.
467 * Same for double-precision floats. Those fit within
468 * 2*sizeof(unsigned long) for all supported architectures.
469 */
470 #undef TRACEPOINT_EVENT_CLASS
471 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
472 static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))\
473 { \
474 struct ltt_event *__event = __tp_data; \
475 struct ltt_channel *__chan = __event->chan; \
476 struct lttng_ust_lib_ring_buffer_ctx __ctx; \
477 size_t __event_len, __event_align; \
478 size_t __dynamic_len_idx = 0; \
479 union { \
480 size_t __dynamic_len[_TP_ARRAY_SIZE(__event_fields___##_provider##___##_name)]; \
481 char __filter_stack_data[2 * sizeof(unsigned long) * _TP_ARRAY_SIZE(__event_fields___##_provider##___##_name)]; \
482 } __stackvar; \
483 int __ret; \
484 \
485 if (0) \
486 (void) __dynamic_len_idx; /* don't warn if unused */ \
487 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->session->active))) \
488 return; \
489 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->enabled))) \
490 return; \
491 if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled))) \
492 return; \
493 if (caa_unlikely(__event->filter)) { \
494 __event_prepare_filter_stack__##_provider##___##_name(__stackvar.__filter_stack_data, \
495 _TP_ARGS_DATA_VAR(_args)); \
496 if (caa_likely(!__event->filter(__event->filter_data, __stackvar.__filter_stack_data))) \
497 return; \
498 } \
499 __event_len = __event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \
500 _TP_ARGS_DATA_VAR(_args)); \
501 __event_align = __event_get_align__##_provider##___##_name(_TP_ARGS_VAR(_args)); \
502 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
503 __event_align, -1, __chan->handle); \
504 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
505 if (__ret < 0) \
506 return; \
507 _fields \
508 __chan->ops->event_commit(&__ctx); \
509 }
510
511 #include TRACEPOINT_INCLUDE
512
513 #undef __get_dynamic_len
514
515 /*
516 * Stage 5.1 of tracepoint event generation.
517 *
518 * Create probe signature
519 */
520
521 /* Reset all macros within TRACEPOINT_EVENT */
522 #include <lttng/ust-tracepoint-event-reset.h>
523
524 #undef TP_ARGS
525 #define TP_ARGS(...) __VA_ARGS__
526
527 #define _TP_EXTRACT_STRING2(...) #__VA_ARGS__
528
529 #undef TRACEPOINT_EVENT_CLASS
530 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
531 const char __tp_event_signature___##_provider##___##_name[] = \
532 _TP_EXTRACT_STRING2(_args);
533
534 #include TRACEPOINT_INCLUDE
535
536 #undef _TP_EXTRACT_STRING2
537
538 /*
539 * Stage 6 of tracepoint event generation.
540 *
541 * Tracepoint loglevel mapping definition generation. We generate a
542 * symbol for each mapping for a provider/event to ensure at most a 1 to
543 * 1 mapping between events and loglevels. If the symbol is repeated,
544 * the compiler will complain.
545 */
546
547 /* Reset all macros within TRACEPOINT_EVENT */
548 #include <lttng/ust-tracepoint-event-reset.h>
549
550 #undef TRACEPOINT_LOGLEVEL
551 #define TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \
552 static const int _loglevel_value___##__provider##___##__name = __loglevel; \
553 static const int *_loglevel___##__provider##___##__name = \
554 &_loglevel_value___##__provider##___##__name;
555
556 #include TRACEPOINT_INCLUDE
557
558 /*
559 * Stage 7.1 of tracepoint event generation.
560 *
561 * Create events description structures. We use a weakref because
562 * loglevels are optional. If not declared, the event will point to the
563 * a loglevel that contains NULL.
564 */
565
566 /* Reset all macros within TRACEPOINT_EVENT */
567 #include <lttng/ust-tracepoint-event-reset.h>
568
569 #undef TRACEPOINT_EVENT_INSTANCE
570 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
571 static const int * \
572 __ref_loglevel___##_provider##___##_name \
573 __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \
574 const struct lttng_event_desc __event_desc___##_provider##_##_name = { \
575 .fields = __event_fields___##_provider##___##_template, \
576 .name = #_provider ":" #_name, \
577 .probe_callback = (void (*)(void)) &__event_probe__##_provider##___##_template,\
578 .nr_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_template), \
579 .loglevel = &__ref_loglevel___##_provider##___##_name, \
580 .signature = __tp_event_signature___##_provider##___##_template, \
581 };
582
583 #include TRACEPOINT_INCLUDE
584
585 /*
586 * Stage 7.2 of tracepoint event generation.
587 *
588 * Create array of events.
589 */
590
591 /* Reset all macros within TRACEPOINT_EVENT */
592 #include <lttng/ust-tracepoint-event-reset.h>
593
594 #undef TRACEPOINT_EVENT_INSTANCE
595 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
596 &__event_desc___##_provider##_##_name,
597
598 static const struct lttng_event_desc *_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = {
599 #include TRACEPOINT_INCLUDE
600 };
601
602
603 /*
604 * Stage 8 of tracepoint event generation.
605 *
606 * Create a toplevel descriptor for the whole probe.
607 */
608
609 /* non-const because list head will be modified when registered. */
610 static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER) = {
611 .provider = __tp_stringify(TRACEPOINT_PROVIDER),
612 .event_desc = _TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER),
613 .nr_events = _TP_ARRAY_SIZE(_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)),
614 };
615
616 /*
617 * Stage 9 of tracepoint event generation.
618 *
619 * Register/unregister probes at module load/unload.
620 *
621 * Generate the constructor as an externally visible symbol for use when
622 * linking the probe statically.
623 */
624
625 /* Reset all macros within TRACEPOINT_EVENT */
626 #include <lttng/ust-tracepoint-event-reset.h>
627 static void __attribute__((constructor))
628 _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void)
629 {
630 int ret;
631
632 ret = ltt_probe_register(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
633 assert(!ret);
634 }
635
636 static void __attribute__((destructor))
637 _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void)
638 {
639 ltt_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
640 }
641
642 int _TP_COMBINE_TOKENS(__tracepoint_provider_, TRACEPOINT_PROVIDER);
This page took 0.058632 seconds and 5 git commands to generate.