Implement custom field support
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 2 May 2016 16:33:13 +0000 (12:33 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 2 May 2016 16:38:13 +0000 (12:38 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-events.h
probes/lttng-events-reset.h
probes/lttng-events-write.h
probes/lttng-tracepoint-event-impl.h

index 9d775d5723d17d614547023c770ecc19ed0c8fbf..5d0ef4dc72b307881e57c730be87e385929b6164 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/kprobes.h>
 #include <linux/kref.h>
 #include <wrapper/uuid.h>
+#include <lttng-tracer.h>
 #include <lttng-abi.h>
 #include <lttng-abi-old.h>
 
index 8262d83eb238572e3b30f593c87cac933f676b4c..3b39233ca69b82a39f9eb4bb565159a09fdab890 100644 (file)
 #undef ctf_string
 #define ctf_string(_item, _src)
 
+#undef ctf_custom_field
+#define ctf_custom_field(_type, _item, _code)
+
+#undef ctf_custom_type
+#define ctf_custom_type(...)
+
+#undef ctf_custom_code
+#define ctf_custom_code(...)
+
+#undef ctf_align
+#define ctf_align(_type)
+
 /* "nowrite" */
 #undef ctf_integer_nowrite
 #define ctf_integer_nowrite(_type, _item, _src)
index 19041e5d70d10cfbc0d1ce85b5a2f1019810a65a..a1f252373394a23bfde07ee286ae29523ed4175b 100644 (file)
 #undef ctf_user_string
 #define ctf_user_string(_item, _src)                                   \
        _ctf_string(_item, _src, 1, 0)
+
+/* types */
+#undef ctf_integer_type
+#define ctf_integer_type(_type, _src)                                  \
+       ctf_integer(_type, unused, _src)
+
+#undef ctf_integer_hex_type
+#define ctf_integer_hex_type(_type, _src)                              \
+       ctf_integer_hex(_type, unused, _src)
+
+#undef ctf_integer_oct_type
+#define ctf_integer_oct_type(_type, _item, _src)                       \
+       ctf_integer_oct(_type, unused, _src)
+
+#undef ctf_integer_network_type
+#define ctf_integer_network_type(_type, _src)                          \
+       ctf_integer_network(_type, unused, _src)
+
+#undef ctf_integer_network_hex_type
+#define ctf_integer_network_hex_type(_type, _src)                      \
+       ctf_integer_network_hex(_type, unused, _src)
+
+#undef ctf_array_type
+#define ctf_array_type(_type, _src, _length)                           \
+       ctf_array(_type, unused, _src, _length)
+
+#undef ctf_array_text_type
+#define ctf_array_text_type(_type, _src, _length)                      \
+       ctf_array_text(_type, unused, _src, _length)
+
+#undef ctf_array_bitfield_type
+#define ctf_array_bitfield_type(_type, _src, _length)                  \
+       ctf_array_bitfield(_type, unused, _src, _length)
+
+#undef ctf_sequence_type
+#define ctf_sequence_type(_type, _src, _length_type, _src_length) \
+       ctf_sequence(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_sequence_hex_type
+#define ctf_sequence_hex_type(_type, _src, _length_type, _src_length) \
+       ctf_sequence_hex(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_sequence_network_type
+#define ctf_sequence_network_type(_type, _src, _length_type, _src_length) \
+       ctf_sequence_network(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_sequence_text_type
+#define ctf_sequence_text_type(_type, _src, _length_type, _src_length) \
+       ctf_sequence_text(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_sequence_bitfield_type
+#define ctf_sequence_bitfield_type(_type, _src, _length_type, _src_length) \
+       ctf_sequence_bitfield(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_string_type
+#define ctf_string_type(_src)                                          \
+       ctf_string(unused, _src)
+
+/* user src types */
+#undef ctf_user_integer_type
+#define ctf_user_integer_type(_type, _src)                             \
+       ctf_user_integer(_type, unused, _src)
+
+#undef ctf_user_integer_hex_type
+#define ctf_user_integer_hex_type(_type, _src)                         \
+       ctf_user_integer_hex(_type, unused, _src)
+
+#undef ctf_user_integer_oct_type
+#define ctf_user_integer_oct_type(_type, _item, _src)                  \
+       ctf_user_integer_oct(_type, unused, _src)
+
+#undef ctf_user_integer_network_type
+#define ctf_user_integer_network_type(_type, _src)                     \
+       ctf_user_integer_network(_type, unused, _src)
+
+#undef ctf_user_integer_network_hex_type
+#define ctf_user_integer_network_hex_type(_type, _src)                 \
+       ctf_user_integer_network_hex(_type, unused, _src)
+
+#undef ctf_user_array_type
+#define ctf_user_array_type(_type, _src, _length)                      \
+       ctf_user_array(_type, unused, _src, _length)
+
+#undef ctf_user_array_text_type
+#define ctf_user_array_text_type(_type, _src, _length)                 \
+       ctf_user_array_text(_type, unused, _src, _length)
+
+#undef ctf_user_array_bitfield_type
+#define ctf_user_array_bitfield_type(_type, _src, _length)             \
+       ctf_user_array_bitfield(_type, unused, _src, _length)
+
+#undef ctf_user_sequence_type
+#define ctf_user_sequence_type(_type, _src, _length_type, _src_length) \
+       ctf_user_sequence(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_user_sequence_hex_type
+#define ctf_user_sequence_hex_type(_type, _src, _length_type, _src_length) \
+       ctf_user_sequence_hex(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_user_sequence_network_type
+#define ctf_user_sequence_network_type(_type, _src, _length_type, _src_length) \
+       ctf_user_sequence_network(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_user_sequence_text_type
+#define ctf_user_sequence_text_type(_type, _src, _length_type, _src_length) \
+       ctf_user_sequence_text(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_user_sequence_bitfield_type
+#define ctf_user_sequence_bitfield_type(_type, _src, _length_type, _src_length) \
+       ctf_user_sequence_bitfield(_type, unused, _src, _length_type, _src_length)
+
+#undef ctf_user_string_type
+#define ctf_user_string_type(_src)                                     \
+       ctf_user_string(unused, _src)
index 42a4be30233c35d74bd56a64d25100a3a3faeb2c..fbedea1c774d50d7294929bfc9cac17cd01fd037 100644 (file)
@@ -303,6 +303,19 @@ void __event_template_proto___##_name(void);
          .user = _user,                                        \
        },
 
+
+#undef ctf_custom_field
+#define ctf_custom_field(_type, _item, _code)                  \
+       {                                                       \
+               .name = #_item,                                 \
+               .type = { _type },                              \
+               .nowrite = 0,                                   \
+               .user = 0,                                      \
+       },
+
+#undef ctf_custom_type
+#define ctf_custom_type(...)   __VA_ARGS__
+
 #undef TP_FIELDS
 #define TP_FIELDS(...) __VA_ARGS__     /* Only one used in this phase */
 
@@ -404,6 +417,19 @@ static void __event_probe__##_name(void *__data);
                        strlen(_src) + 1;                                      \
        }
 
+#undef ctf_align
+#define ctf_align(_type)                                               \
+       __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type));
+
+#undef ctf_custom_field
+#define ctf_custom_field(_type, _item, _code)                          \
+       {                                                               \
+               _code                                                   \
+       }
+
+#undef ctf_custom_code
+#define ctf_custom_code(...)           __VA_ARGS__
+
 #undef TP_PROTO
 #define TP_PROTO(...)  __VA_ARGS__
 
@@ -673,6 +699,10 @@ void __event_prepare_filter_stack__##_name(char *__stack_data,                   \
 #undef _ctf_string
 #define _ctf_string(_item, _src, _user, _nowrite)
 
+#undef ctf_align
+#define ctf_align(_type)                                               \
+       __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
+
 #undef TP_PROTO
 #define TP_PROTO(...)  __VA_ARGS__
 
@@ -682,6 +712,15 @@ void __event_prepare_filter_stack__##_name(char *__stack_data,                   \
 #undef TP_locvar
 #define TP_locvar(...) __VA_ARGS__
 
+#undef ctf_custom_field
+#define ctf_custom_field(_type, _item, _code)          _code
+
+#undef ctf_custom_code
+#define ctf_custom_code(...)                                           \
+       {                                                               \
+               __VA_ARGS__                                             \
+       }
+
 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
 static inline size_t __event_get_align__##_name(void *__tp_locvar, _proto)    \
@@ -896,6 +935,20 @@ static inline size_t __event_get_align__##_name(void *__tp_locvar)       \
                        __get_dynamic_len(dest));                       \
        }
 
+
+#undef ctf_align
+#define ctf_align(_type)                                               \
+       lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));
+
+#undef ctf_custom_field
+#define ctf_custom_field(_type, _item, _code)          _code
+
+#undef ctf_custom_code
+#define ctf_custom_code(...)                                           \
+       {                                                               \
+               __VA_ARGS__                                             \
+       }
+
 /* Beware: this get len actually consumes the len value */
 #undef __get_dynamic_len
 #define __get_dynamic_len(field)       this_cpu_ptr(&lttng_dynamic_len_stack)->stack[__dynamic_len_idx++]
This page took 0.033646 seconds and 5 git commands to generate.