1 #ifndef _LTT_FACILITY_USER_GENERIC_H_
2 #define _LTT_FACILITY_USER_GENERIC_H_
5 #include <ltt/ltt-facility-id-user_generic.h>
6 #include <ltt/ltt-usertrace.h>
10 /* Event string structures */
11 static inline void lttng_write_string_user_generic_string_data(
22 /* Flush pending memcpy */
25 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
33 *to
+= ltt_align(*to
, align
); /* align output */
35 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
38 /* Contains variable sized fields : must explode the structure */
40 size
= strlen(obj
) + 1; /* Include final NULL char. */
42 memcpy(buffer
+*to_base
+*to
, obj
, size
);
45 /* Realign the *to_base on arch size, set *to to 0 */
46 *to
+= ltt_align(*to
, sizeof(void *));
47 *to_base
= *to_base
+*to
;
50 /* Put source *from just after the C string */
55 /* Event string logging function */
56 #ifndef LTT_TRACE_FAST
57 static inline int trace_user_generic_string(
58 const char * lttng_param_data
)
66 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
67 size_t *to_base
= &real_to_base
;
69 size_t *to
= &real_to
;
71 size_t *len
= &real_len
;
74 const void *real_from
;
75 const void **from
= &real_from
;
76 /* For each field, calculate the field size. */
77 /* size = *to_base + *to + *len */
78 /* Assume that the padding for alignment starts at a
79 * sizeof(void *) address. */
81 *from
= lttng_param_data
;
82 lttng_write_string_user_generic_string_data(buffer
, to_base
, to
, from
, len
, lttng_param_data
);
84 reserve_size
= *to_base
+ *to
+ *len
;
86 char stack_buffer
[reserve_size
];
87 buffer
= stack_buffer
;
89 *to_base
= *to
= *len
= 0;
91 *from
= lttng_param_data
;
92 lttng_write_string_user_generic_string_data(buffer
, to_base
, to
, from
, len
, lttng_param_data
);
94 /* Flush pending memcpy */
96 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
101 ret
= ltt_trace_generic(ltt_facility_user_generic_B1865E44
, event_user_generic_string
, buffer
, reserve_size
, LTT_BLOCKING
);
108 #endif //!LTT_TRACE_FAST
110 #ifdef LTT_TRACE_FAST
111 static inline int trace_user_generic_string(
112 const char * lttng_param_data
)
119 struct ltt_trace_info
*trace
= thread_trace_info
;
120 struct ltt_buf
*ltt_buf
;
122 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
123 size_t *to_base
= &real_to_base
;
125 size_t *to
= &real_to
;
127 size_t *len
= &real_len
;
130 const void *real_from
;
131 const void **from
= &real_from
;
133 size_t before_hdr_pad
, after_hdr_pad
, header_size
;
137 trace
= thread_trace_info
;
141 /* For each field, calculate the field size. */
142 /* size = *to_base + *to + *len */
143 /* Assume that the padding for alignment starts at a
144 * sizeof(void *) address. */
146 *from
= lttng_param_data
;
147 lttng_write_string_user_generic_string_data(buffer
, to_base
, to
, from
, len
, lttng_param_data
);
149 reserve_size
= *to_base
+ *to
+ *len
;
151 index
= ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44
,
152 event_user_generic_string
);
155 ltt_buf
= ltt_get_channel_from_index(trace
, index
);
157 buffer
= ltt_reserve_slot(trace
, ltt_buf
,
158 reserve_size
, &slot_size
, &tsc
,
159 &before_hdr_pad
, &after_hdr_pad
, &header_size
);
160 if(!buffer
) goto end
; /* buffer full */
162 *to_base
= *to
= *len
= 0;
164 ltt_write_event_header(trace
, ltt_buf
, buffer
,
165 ltt_facility_user_generic_B1865E44
, event_user_generic_string
,
166 reserve_size
, before_hdr_pad
, tsc
);
167 *to_base
+= before_hdr_pad
+ after_hdr_pad
+ header_size
;
169 *from
= lttng_param_data
;
170 lttng_write_string_user_generic_string_data(buffer
, to_base
, to
, from
, len
, lttng_param_data
);
172 /* Flush pending memcpy */
174 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
179 ltt_commit_slot(ltt_buf
, buffer
, slot_size
);
187 #endif //LTT_TRACE_FAST
189 /* Event string_pointer structures */
190 static inline void lttng_write_string_user_generic_string_pointer_string(
201 /* Flush pending memcpy */
204 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
209 align
= sizeof(char);
212 *to
+= ltt_align(*to
, align
); /* align output */
214 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
217 /* Contains variable sized fields : must explode the structure */
219 size
= strlen(obj
) + 1; /* Include final NULL char. */
221 memcpy(buffer
+*to_base
+*to
, obj
, size
);
224 /* Realign the *to_base on arch size, set *to to 0 */
225 *to
+= ltt_align(*to
, sizeof(void *));
226 *to_base
= *to_base
+*to
;
229 /* Put source *from just after the C string */
234 /* Event string_pointer logging function */
235 #ifndef LTT_TRACE_FAST
236 static inline int trace_user_generic_string_pointer(
237 const char * lttng_param_string
,
238 const void * lttng_param_pointer
)
246 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
247 size_t *to_base
= &real_to_base
;
249 size_t *to
= &real_to
;
251 size_t *len
= &real_len
;
255 const void *real_from
;
256 const void **from
= &real_from
;
257 /* For each field, calculate the field size. */
258 /* size = *to_base + *to + *len */
259 /* Assume that the padding for alignment starts at a
260 * sizeof(void *) address. */
262 *from
= lttng_param_string
;
263 lttng_write_string_user_generic_string_pointer_string(buffer
, to_base
, to
, from
, len
, lttng_param_string
);
265 *from
= <tng_param_pointer
;
266 align
= sizeof(const void *);
269 *to
+= ltt_align(*to
, align
); /* align output */
271 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
274 *len
+= sizeof(const void *);
276 reserve_size
= *to_base
+ *to
+ *len
;
278 char stack_buffer
[reserve_size
];
279 buffer
= stack_buffer
;
281 *to_base
= *to
= *len
= 0;
283 *from
= lttng_param_string
;
284 lttng_write_string_user_generic_string_pointer_string(buffer
, to_base
, to
, from
, len
, lttng_param_string
);
286 /* Flush pending memcpy */
288 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
293 *from
= <tng_param_pointer
;
294 align
= sizeof(const void *);
297 *to
+= ltt_align(*to
, align
); /* align output */
299 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
302 *len
+= sizeof(const void *);
304 /* Flush pending memcpy */
306 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
311 ret
= ltt_trace_generic(ltt_facility_user_generic_B1865E44
, event_user_generic_string_pointer
, buffer
, reserve_size
, LTT_BLOCKING
);
318 #endif //!LTT_TRACE_FAST
320 #ifdef LTT_TRACE_FAST
321 static inline int trace_user_generic_string_pointer(
322 const char * lttng_param_string
,
323 const void * lttng_param_pointer
)
330 struct ltt_trace_info
*trace
= thread_trace_info
;
331 struct ltt_buf
*ltt_buf
;
333 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
334 size_t *to_base
= &real_to_base
;
336 size_t *to
= &real_to
;
338 size_t *len
= &real_len
;
342 const void *real_from
;
343 const void **from
= &real_from
;
345 size_t before_hdr_pad
, after_hdr_pad
, header_size
;
349 trace
= thread_trace_info
;
353 /* For each field, calculate the field size. */
354 /* size = *to_base + *to + *len */
355 /* Assume that the padding for alignment starts at a
356 * sizeof(void *) address. */
358 *from
= lttng_param_string
;
359 lttng_write_string_user_generic_string_pointer_string(buffer
, to_base
, to
, from
, len
, lttng_param_string
);
361 *from
= <tng_param_pointer
;
362 align
= sizeof(const void *);
365 *to
+= ltt_align(*to
, align
); /* align output */
367 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
370 *len
+= sizeof(const void *);
372 reserve_size
= *to_base
+ *to
+ *len
;
374 index
= ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44
,
375 event_user_generic_string_pointer
);
378 ltt_buf
= ltt_get_channel_from_index(trace
, index
);
380 buffer
= ltt_reserve_slot(trace
, ltt_buf
,
381 reserve_size
, &slot_size
, &tsc
,
382 &before_hdr_pad
, &after_hdr_pad
, &header_size
);
383 if(!buffer
) goto end
; /* buffer full */
385 *to_base
= *to
= *len
= 0;
387 ltt_write_event_header(trace
, ltt_buf
, buffer
,
388 ltt_facility_user_generic_B1865E44
, event_user_generic_string_pointer
,
389 reserve_size
, before_hdr_pad
, tsc
);
390 *to_base
+= before_hdr_pad
+ after_hdr_pad
+ header_size
;
392 *from
= lttng_param_string
;
393 lttng_write_string_user_generic_string_pointer_string(buffer
, to_base
, to
, from
, len
, lttng_param_string
);
395 /* Flush pending memcpy */
397 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
402 *from
= <tng_param_pointer
;
403 align
= sizeof(const void *);
406 *to
+= ltt_align(*to
, align
); /* align output */
408 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
411 *len
+= sizeof(const void *);
413 /* Flush pending memcpy */
415 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
420 ltt_commit_slot(ltt_buf
, buffer
, slot_size
);
428 #endif //LTT_TRACE_FAST
430 /* Event slow_printf structures */
431 static inline void lttng_write_string_user_generic_slow_printf_string(
442 /* Flush pending memcpy */
445 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
450 align
= sizeof(char);
453 *to
+= ltt_align(*to
, align
); /* align output */
455 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
458 /* Contains variable sized fields : must explode the structure */
460 size
= strlen(obj
) + 1; /* Include final NULL char. */
462 memcpy(buffer
+*to_base
+*to
, obj
, size
);
465 /* Realign the *to_base on arch size, set *to to 0 */
466 *to
+= ltt_align(*to
, sizeof(void *));
467 *to_base
= *to_base
+*to
;
470 /* Put source *from just after the C string */
475 /* Event slow_printf logging function */
476 #ifndef LTT_TRACE_FAST
477 static inline int trace_user_generic_slow_printf_param_buffer(
486 reserve_size
= ltt_align(reserve_size
, sizeof(void *));
488 ret
= ltt_trace_generic(ltt_facility_user_generic_B1865E44
, event_user_generic_slow_printf
, buffer
, reserve_size
, LTT_BLOCKING
);
495 #endif //!LTT_TRACE_FAST
497 #ifdef LTT_TRACE_FAST
498 static inline int trace_user_generic_slow_printf(
499 const char * lttng_param_string
)
506 struct ltt_trace_info
*trace
= thread_trace_info
;
507 struct ltt_buf
*ltt_buf
;
509 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
510 size_t *to_base
= &real_to_base
;
512 size_t *to
= &real_to
;
514 size_t *len
= &real_len
;
517 const void *real_from
;
518 const void **from
= &real_from
;
520 size_t before_hdr_pad
, after_hdr_pad
, header_size
;
524 trace
= thread_trace_info
;
528 /* For each field, calculate the field size. */
529 /* size = *to_base + *to + *len */
530 /* Assume that the padding for alignment starts at a
531 * sizeof(void *) address. */
533 *from
= lttng_param_string
;
534 lttng_write_string_user_generic_slow_printf_string(buffer
, to_base
, to
, from
, len
, lttng_param_string
);
536 reserve_size
= *to_base
+ *to
+ *len
;
538 index
= ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44
,
539 event_user_generic_slow_printf
);
542 ltt_buf
= ltt_get_channel_from_index(trace
, index
);
544 buffer
= ltt_reserve_slot(trace
, ltt_buf
,
545 reserve_size
, &slot_size
, &tsc
,
546 &before_hdr_pad
, &after_hdr_pad
, &header_size
);
547 if(!buffer
) goto end
; /* buffer full */
549 *to_base
= *to
= *len
= 0;
551 ltt_write_event_header(trace
, ltt_buf
, buffer
,
552 ltt_facility_user_generic_B1865E44
, event_user_generic_slow_printf
,
553 reserve_size
, before_hdr_pad
, tsc
);
554 *to_base
+= before_hdr_pad
+ after_hdr_pad
+ header_size
;
556 *from
= lttng_param_string
;
557 lttng_write_string_user_generic_slow_printf_string(buffer
, to_base
, to
, from
, len
, lttng_param_string
);
559 /* Flush pending memcpy */
561 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
566 ltt_commit_slot(ltt_buf
, buffer
, slot_size
);
574 #endif //LTT_TRACE_FAST
576 /* Event function_entry structures */
578 /* Event function_entry logging function */
579 #ifndef LTT_TRACE_FAST
580 static inline __attribute__((no_instrument_function
)) int trace_user_generic_function_entry(
581 const void * lttng_param_this_fn
,
582 const void * lttng_param_call_site
)
590 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
591 size_t *to_base
= &real_to_base
;
593 size_t *to
= &real_to
;
595 size_t *len
= &real_len
;
599 const void *real_from
;
600 const void **from
= &real_from
;
601 /* For each field, calculate the field size. */
602 /* size = *to_base + *to + *len */
603 /* Assume that the padding for alignment starts at a
604 * sizeof(void *) address. */
606 *from
= <tng_param_this_fn
;
607 align
= sizeof(const void *);
610 *to
+= ltt_align(*to
, align
); /* align output */
612 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
615 *len
+= sizeof(const void *);
617 *from
= <tng_param_call_site
;
618 align
= sizeof(const void *);
621 *to
+= ltt_align(*to
, align
); /* align output */
623 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
626 *len
+= sizeof(const void *);
628 reserve_size
= *to_base
+ *to
+ *len
;
630 char stack_buffer
[reserve_size
];
631 buffer
= stack_buffer
;
633 *to_base
= *to
= *len
= 0;
635 *from
= <tng_param_this_fn
;
636 align
= sizeof(const void *);
639 *to
+= ltt_align(*to
, align
); /* align output */
641 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
644 *len
+= sizeof(const void *);
646 /* Flush pending memcpy */
648 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
653 *from
= <tng_param_call_site
;
654 align
= sizeof(const void *);
657 *to
+= ltt_align(*to
, align
); /* align output */
659 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
662 *len
+= sizeof(const void *);
664 /* Flush pending memcpy */
666 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
671 ret
= ltt_trace_generic(ltt_facility_user_generic_B1865E44
, event_user_generic_function_entry
, buffer
, reserve_size
, LTT_BLOCKING
);
678 #endif //!LTT_TRACE_FAST
680 #ifdef LTT_TRACE_FAST
681 static inline __attribute__((no_instrument_function
)) int trace_user_generic_function_entry(
682 const void * lttng_param_this_fn
,
683 const void * lttng_param_call_site
)
690 struct ltt_trace_info
*trace
= thread_trace_info
;
691 struct ltt_buf
*ltt_buf
;
693 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
694 size_t *to_base
= &real_to_base
;
696 size_t *to
= &real_to
;
698 size_t *len
= &real_len
;
702 const void *real_from
;
703 const void **from
= &real_from
;
705 size_t before_hdr_pad
, after_hdr_pad
, header_size
;
709 trace
= thread_trace_info
;
713 /* For each field, calculate the field size. */
714 /* size = *to_base + *to + *len */
715 /* Assume that the padding for alignment starts at a
716 * sizeof(void *) address. */
718 *from
= <tng_param_this_fn
;
719 align
= sizeof(const void *);
722 *to
+= ltt_align(*to
, align
); /* align output */
724 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
727 *len
+= sizeof(const void *);
729 *from
= <tng_param_call_site
;
730 align
= sizeof(const void *);
733 *to
+= ltt_align(*to
, align
); /* align output */
735 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
738 *len
+= sizeof(const void *);
740 reserve_size
= *to_base
+ *to
+ *len
;
742 index
= ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44
,
743 event_user_generic_function_entry
);
746 ltt_buf
= ltt_get_channel_from_index(trace
, index
);
748 buffer
= ltt_reserve_slot(trace
, ltt_buf
,
749 reserve_size
, &slot_size
, &tsc
,
750 &before_hdr_pad
, &after_hdr_pad
, &header_size
);
751 if(!buffer
) goto end
; /* buffer full */
753 *to_base
= *to
= *len
= 0;
755 ltt_write_event_header(trace
, ltt_buf
, buffer
,
756 ltt_facility_user_generic_B1865E44
, event_user_generic_function_entry
,
757 reserve_size
, before_hdr_pad
, tsc
);
758 *to_base
+= before_hdr_pad
+ after_hdr_pad
+ header_size
;
760 *from
= <tng_param_this_fn
;
761 align
= sizeof(const void *);
764 *to
+= ltt_align(*to
, align
); /* align output */
766 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
769 *len
+= sizeof(const void *);
771 /* Flush pending memcpy */
773 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
778 *from
= <tng_param_call_site
;
779 align
= sizeof(const void *);
782 *to
+= ltt_align(*to
, align
); /* align output */
784 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
787 *len
+= sizeof(const void *);
789 /* Flush pending memcpy */
791 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
796 ltt_commit_slot(ltt_buf
, buffer
, slot_size
);
804 #endif //LTT_TRACE_FAST
806 /* Event function_exit structures */
808 /* Event function_exit logging function */
809 #ifndef LTT_TRACE_FAST
810 static inline __attribute__((no_instrument_function
)) int trace_user_generic_function_exit(
811 const void * lttng_param_this_fn
,
812 const void * lttng_param_call_site
)
820 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
821 size_t *to_base
= &real_to_base
;
823 size_t *to
= &real_to
;
825 size_t *len
= &real_len
;
829 const void *real_from
;
830 const void **from
= &real_from
;
831 /* For each field, calculate the field size. */
832 /* size = *to_base + *to + *len */
833 /* Assume that the padding for alignment starts at a
834 * sizeof(void *) address. */
836 *from
= <tng_param_this_fn
;
837 align
= sizeof(const void *);
840 *to
+= ltt_align(*to
, align
); /* align output */
842 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
845 *len
+= sizeof(const void *);
847 *from
= <tng_param_call_site
;
848 align
= sizeof(const void *);
851 *to
+= ltt_align(*to
, align
); /* align output */
853 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
856 *len
+= sizeof(const void *);
858 reserve_size
= *to_base
+ *to
+ *len
;
860 char stack_buffer
[reserve_size
];
861 buffer
= stack_buffer
;
863 *to_base
= *to
= *len
= 0;
865 *from
= <tng_param_this_fn
;
866 align
= sizeof(const void *);
869 *to
+= ltt_align(*to
, align
); /* align output */
871 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
874 *len
+= sizeof(const void *);
876 /* Flush pending memcpy */
878 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
883 *from
= <tng_param_call_site
;
884 align
= sizeof(const void *);
887 *to
+= ltt_align(*to
, align
); /* align output */
889 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
892 *len
+= sizeof(const void *);
894 /* Flush pending memcpy */
896 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
901 ret
= ltt_trace_generic(ltt_facility_user_generic_B1865E44
, event_user_generic_function_exit
, buffer
, reserve_size
, LTT_BLOCKING
);
908 #endif //!LTT_TRACE_FAST
910 #ifdef LTT_TRACE_FAST
911 static inline __attribute__((no_instrument_function
)) int trace_user_generic_function_exit(
912 const void * lttng_param_this_fn
,
913 const void * lttng_param_call_site
)
920 struct ltt_trace_info
*trace
= thread_trace_info
;
921 struct ltt_buf
*ltt_buf
;
923 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
924 size_t *to_base
= &real_to_base
;
926 size_t *to
= &real_to
;
928 size_t *len
= &real_len
;
932 const void *real_from
;
933 const void **from
= &real_from
;
935 size_t before_hdr_pad
, after_hdr_pad
, header_size
;
939 trace
= thread_trace_info
;
943 /* For each field, calculate the field size. */
944 /* size = *to_base + *to + *len */
945 /* Assume that the padding for alignment starts at a
946 * sizeof(void *) address. */
948 *from
= <tng_param_this_fn
;
949 align
= sizeof(const void *);
952 *to
+= ltt_align(*to
, align
); /* align output */
954 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
957 *len
+= sizeof(const void *);
959 *from
= <tng_param_call_site
;
960 align
= sizeof(const void *);
963 *to
+= ltt_align(*to
, align
); /* align output */
965 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
968 *len
+= sizeof(const void *);
970 reserve_size
= *to_base
+ *to
+ *len
;
972 index
= ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44
,
973 event_user_generic_function_exit
);
976 ltt_buf
= ltt_get_channel_from_index(trace
, index
);
978 buffer
= ltt_reserve_slot(trace
, ltt_buf
,
979 reserve_size
, &slot_size
, &tsc
,
980 &before_hdr_pad
, &after_hdr_pad
, &header_size
);
981 if(!buffer
) goto end
; /* buffer full */
983 *to_base
= *to
= *len
= 0;
985 ltt_write_event_header(trace
, ltt_buf
, buffer
,
986 ltt_facility_user_generic_B1865E44
, event_user_generic_function_exit
,
987 reserve_size
, before_hdr_pad
, tsc
);
988 *to_base
+= before_hdr_pad
+ after_hdr_pad
+ header_size
;
990 *from
= <tng_param_this_fn
;
991 align
= sizeof(const void *);
994 *to
+= ltt_align(*to
, align
); /* align output */
996 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
999 *len
+= sizeof(const void *);
1001 /* Flush pending memcpy */
1003 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
1008 *from
= <tng_param_call_site
;
1009 align
= sizeof(const void *);
1012 *to
+= ltt_align(*to
, align
); /* align output */
1014 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
1017 *len
+= sizeof(const void *);
1019 /* Flush pending memcpy */
1021 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
1026 ltt_commit_slot(ltt_buf
, buffer
, slot_size
);
1034 #endif //LTT_TRACE_FAST
1036 /* Event thread_brand structures */
1037 static inline void lttng_write_string_user_generic_thread_brand_name(
1048 /* Flush pending memcpy */
1051 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
1056 align
= sizeof(char);
1059 *to
+= ltt_align(*to
, align
); /* align output */
1061 *len
+= ltt_align(*to
+*len
, align
); /* alignment, ok to do a memcpy of it */
1064 /* Contains variable sized fields : must explode the structure */
1066 size
= strlen(obj
) + 1; /* Include final NULL char. */
1068 memcpy(buffer
+*to_base
+*to
, obj
, size
);
1071 /* Realign the *to_base on arch size, set *to to 0 */
1072 *to
+= ltt_align(*to
, sizeof(void *));
1073 *to_base
= *to_base
+*to
;
1076 /* Put source *from just after the C string */
1081 /* Event thread_brand logging function */
1082 #ifndef LTT_TRACE_FAST
1083 static inline int trace_user_generic_thread_brand(
1084 const char * lttng_param_name
)
1091 void *buffer
= NULL
;
1092 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
1093 size_t *to_base
= &real_to_base
;
1095 size_t *to
= &real_to
;
1096 size_t real_len
= 0;
1097 size_t *len
= &real_len
;
1098 size_t reserve_size
;
1100 const void *real_from
;
1101 const void **from
= &real_from
;
1102 /* For each field, calculate the field size. */
1103 /* size = *to_base + *to + *len */
1104 /* Assume that the padding for alignment starts at a
1105 * sizeof(void *) address. */
1107 *from
= lttng_param_name
;
1108 lttng_write_string_user_generic_thread_brand_name(buffer
, to_base
, to
, from
, len
, lttng_param_name
);
1110 reserve_size
= *to_base
+ *to
+ *len
;
1112 char stack_buffer
[reserve_size
];
1113 buffer
= stack_buffer
;
1115 *to_base
= *to
= *len
= 0;
1117 *from
= lttng_param_name
;
1118 lttng_write_string_user_generic_thread_brand_name(buffer
, to_base
, to
, from
, len
, lttng_param_name
);
1120 /* Flush pending memcpy */
1122 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
1127 ret
= ltt_trace_generic(ltt_facility_user_generic_B1865E44
, event_user_generic_thread_brand
, buffer
, reserve_size
, LTT_BLOCKING
);
1134 #endif //!LTT_TRACE_FAST
1136 #ifdef LTT_TRACE_FAST
1137 static inline int trace_user_generic_thread_brand(
1138 const char * lttng_param_name
)
1145 struct ltt_trace_info
*trace
= thread_trace_info
;
1146 struct ltt_buf
*ltt_buf
;
1147 void *buffer
= NULL
;
1148 size_t real_to_base
= 0; /* The buffer is allocated on arch_size alignment */
1149 size_t *to_base
= &real_to_base
;
1151 size_t *to
= &real_to
;
1152 size_t real_len
= 0;
1153 size_t *len
= &real_len
;
1154 size_t reserve_size
;
1156 const void *real_from
;
1157 const void **from
= &real_from
;
1159 size_t before_hdr_pad
, after_hdr_pad
, header_size
;
1163 trace
= thread_trace_info
;
1167 /* For each field, calculate the field size. */
1168 /* size = *to_base + *to + *len */
1169 /* Assume that the padding for alignment starts at a
1170 * sizeof(void *) address. */
1172 *from
= lttng_param_name
;
1173 lttng_write_string_user_generic_thread_brand_name(buffer
, to_base
, to
, from
, len
, lttng_param_name
);
1175 reserve_size
= *to_base
+ *to
+ *len
;
1177 index
= ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44
,
1178 event_user_generic_thread_brand
);
1181 ltt_buf
= ltt_get_channel_from_index(trace
, index
);
1183 buffer
= ltt_reserve_slot(trace
, ltt_buf
,
1184 reserve_size
, &slot_size
, &tsc
,
1185 &before_hdr_pad
, &after_hdr_pad
, &header_size
);
1186 if(!buffer
) goto end
; /* buffer full */
1188 *to_base
= *to
= *len
= 0;
1190 ltt_write_event_header(trace
, ltt_buf
, buffer
,
1191 ltt_facility_user_generic_B1865E44
, event_user_generic_thread_brand
,
1192 reserve_size
, before_hdr_pad
, tsc
);
1193 *to_base
+= before_hdr_pad
+ after_hdr_pad
+ header_size
;
1195 *from
= lttng_param_name
;
1196 lttng_write_string_user_generic_thread_brand_name(buffer
, to_base
, to
, from
, len
, lttng_param_name
);
1198 /* Flush pending memcpy */
1200 memcpy(buffer
+*to_base
+*to
, *from
, *len
);
1205 ltt_commit_slot(ltt_buf
, buffer
, slot_size
);
1213 #endif //LTT_TRACE_FAST
1215 #endif //_LTT_FACILITY_USER_GENERIC_H_