lttng-events TRACE_EVENT generator cleanup
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 16 Sep 2011 16:31:37 +0000 (12:31 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 16 Sep 2011 16:31:37 +0000 (12:31 -0400)
Adds support for _hex variants while cleaning up and refactoring macros,
removing duplicatas.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
probes/lttng-events-reset.h
probes/lttng-events.h

index 5a4089d9dab505d33f37f14a61ffca5408701cc2..3157f1e48dd9f8b3ce8cf5a32ae3b3b389049de1 100644 (file)
@@ -8,22 +8,16 @@
 
 /* Reset macros used within TRACE_EVENT to "nothing" */
 
-#undef __field
-#define __field(_type, _item)
+#undef __field_full
+#define __field_full(_type, _item, _order, _base)
 
-#undef __field_ext
-#define __field_ext(_type, _item, _filter_type)
+#undef __array_enc_ext
+#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)
 
-#undef __field_network
-#define __field_network(_type, _item)
+#undef __dynamic_array_enc_ext
+#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)
 
-#undef __array
-#define __array(_type, _item, _length)
-
-#undef __dynamic_array
-#define __dynamic_array(_type, _item, _length)
-
-#undef __dynamic_array
+#undef __dynamic_array_len
 #define __dynamic_array_len(_type, _item, _length)
 
 #undef __string
index a267991a2d239d7cc83786cfc0b348c24b777009..d517da725d580a0f1f61a35e61aa960abdc7390f 100644 (file)
@@ -83,25 +83,31 @@ void trace_##_name(_proto);
 
 /* Named field types must be defined in lttng-types.h */
 
-#undef __field
-#define __field(_type, _item)                                  \
+#undef __field_full
+#define __field_full(_type, _item, _order, _base)              \
        {                                                       \
          .name = #_item,                                       \
-         .type = __type_integer(_type, __BYTE_ORDER, 10, none),\
+         .type = __type_integer(_type, _order, _base, none),   \
        },
 
+#undef __field
+#define __field(_type, _item)                                  \
+       __field_full(_type, _item, __BYTE_ORDER, 10)
+
 #undef __field_ext
-#define __field_ext(_type, _item, _filter_type)                __field(_type, _item)
+#define __field_ext(_type, _item, _filter_type)                        \
+       __field(_type, _item)
 
 #undef __field_network
 #define __field_network(_type, _item)                          \
-       {                                                       \
-         .name = #_item,                                       \
-         .type = __type_integer(_type, __BIG_ENDIAN, 10, none),\
-       },
+       __field_full(_type, _item, __BIG_ENDIAN, 10)
+
+#undef __field_network_hex
+#define __field_network_hex(_type, _item)                              \
+       __field_full(_type, _item, __BIG_ENDIAN, 16)
 
-#undef __array_enc
-#define __array_enc(_type, _item, _length, _encoding)          \
+#undef __array_enc_ext
+#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
        {                                                       \
          .name = #_item,                                       \
          .type =                                               \
@@ -110,21 +116,25 @@ void trace_##_name(_proto);
                  .u.array =                                    \
                        {                                       \
                            .length = _length,                  \
-                           .elem_type = __type_integer(_type, __BYTE_ORDER, 10, _encoding), \
+                           .elem_type = __type_integer(_type, _order, _base, _encoding), \
                        },                                      \
                },                                              \
        },
 
 #undef __array
 #define __array(_type, _item, _length)                         \
-       __array_enc(_type, _item, _length, none)
+       __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, none)
 
 #undef __array_text
 #define __array_text(_type, _item, _length)                    \
-       __array_enc(_type, _item, _length, UTF8)
+       __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, UTF8)
 
-#undef __dynamic_array_enc
-#define __dynamic_array_enc(_type, _item, _length, _encoding)  \
+#undef __array_hex
+#define __array_hex(_type, _item, _length)                     \
+       __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 16, none)
+
+#undef __dynamic_array_enc_ext
+#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding) \
        {                                                       \
          .name = #_item,                                       \
          .type =                                               \
@@ -133,18 +143,22 @@ void trace_##_name(_proto);
                  .u.sequence =                                 \
                        {                                       \
                            .length_type = __type_integer(u32, __BYTE_ORDER, 10, none), \
-                           .elem_type = __type_integer(_type, __BYTE_ORDER, 10, _encoding), \
+                           .elem_type = __type_integer(_type, _order, _base, _encoding), \
                        },                                      \
                },                                              \
        },
 
 #undef __dynamic_array
 #define __dynamic_array(_type, _item, _length)                 \
-       __dynamic_array_enc(_type, _item, _length, none)
+       __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, none)
 
 #undef __dynamic_array_text
 #define __dynamic_array_text(_type, _item, _length)            \
-       __dynamic_array_enc(_type, _item, _length, UTF8)
+       __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, UTF8)
+
+#undef __dynamic_array_hex
+#define __dynamic_array_hex(_type, _item, _length)             \
+       __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 16, none)
 
 #undef __string
 #define __string(_item, _src)                                  \
@@ -246,25 +260,18 @@ static struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
 
 /* Named field types must be defined in lttng-types.h */
 
-#undef __field
-#define __field(_type, _item)                                                 \
+#undef __field_full
+#define __field_full(_type, _item, _order, _base)                             \
        __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
        __event_len += sizeof(_type);
 
-#undef __field_ext
-#define __field_ext(_type, _item, _filter_type)        __field(_type, _item)
-
-#undef __array
-#define __array(_type, _item, _length)                                        \
+#undef __array_enc_ext
+#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)       \
        __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
        __event_len += sizeof(_type) * (_length);
 
-#undef __array_text
-#define __array_text(_type, _item, _length)                                   \
-       __array(_type, _item, _length)
-
-#undef __dynamic_array
-#define __dynamic_array(_type, _item, _length)                                \
+#undef __dynamic_array_enc_ext
+#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
        __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(u32));   \
        __event_len += sizeof(u32);                                            \
        __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \
@@ -272,10 +279,6 @@ static struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
        __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx];       \
        __dynamic_len_idx++;
 
-#undef __dynamic_array_text
-#define __dynamic_array_text(_type, _item, _length)                           \
-       __dynamic_array(_type, _item, _length)
-
 #undef __string
 #define __string(_item, _src)                                                 \
        __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1;
@@ -311,30 +314,19 @@ static inline size_t __event_get_size__##_name(size_t *__dynamic_len, _proto) \
 
 /* Named field types must be defined in lttng-types.h */
 
-#undef __field
-#define __field(_type, _item)                                            \
+#undef __field_full
+#define __field_full(_type, _item, _order, _base)                        \
        __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
 
-#undef __field_ext
-#define __field_ext(_type, _item, _filter_type)        __field(_type, _item)
-
-#undef __array
-#define __array(_type, _item, _length)                                   \
+#undef __array_enc_ext
+#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)  \
        __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
 
-#undef __array_text
-#define __array_text(_type, _item, _length)                              \
-       __array(_type, _item, _length)
-
-#undef __dynamic_array
-#define __dynamic_array(_type, _item, _length)                           \
+#undef __dynamic_array_enc_ext
+#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
        __event_align = max_t(size_t, __event_align, ltt_alignof(u32));   \
        __event_align = max_t(size_t, __event_align, ltt_alignof(_type));
 
-#undef __dynamic_array_text
-#define __dynamic_array_text(_type, _item, _length)                      \
-       __dynamic_array(_type, _item, _length)
-
 #undef __string
 #define __string(_item, _src)
 
@@ -367,25 +359,16 @@ static inline size_t __event_get_align__##_name(_proto)                         \
 
 /* Named field types must be defined in lttng-types.h */
 
-#undef __field
-#define __field(_type, _item)  _type   _item;
-
-#undef __field_ext
-#define __field_ext(_type, _item, _filter_type)        __field(_type, _item)
-
-#undef __array
-#define __array(_type, _item, _length) _type   _item;
+#undef __field_full
+#define __field_full(_type, _item, _order, _base)      _type   _item;
 
-#undef __array_text
-#define __array_text(_type, _item, _length)                              \
-       __array(_type, _item, _length)
+#undef __array_enc_ext
+#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)  \
+       _type   _item;
 
-#undef __dynamic_array
-#define __dynamic_array(_type, _item, _length) _type   _item;
-
-#undef __dynamic_array_text
-#define __dynamic_array_text(_type, _item, _length)                      \
-       __dynamic_array(_type, _item, _length)
+#undef __dynamic_array_enc_ext
+#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
+       _type   _item;
 
 #undef __string
 #define __string(_item, _src)  char _item;
@@ -415,34 +398,23 @@ struct __event_typemap__##_name {                                       \
 
 #include "lttng-events-reset.h"        /* Reset all macros within TRACE_EVENT */
 
-#undef __field
-#define __field(_type, _item)                                          \
+#undef __field_full
+#define __field_full(_type, _item, _order, _base)                      \
        goto __assign_##_item;                                          \
 __end_field_##_item:
 
-#undef __field_ext
-#define __field_ext(_type, _item, _filter_type)        __field(_type, _item)
-
-#undef __array
-#define __array(_type, _item, _length)                                 \
+#undef __array_enc_ext
+#define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
        goto __assign_##_item;                                          \
 __end_field_##_item:
 
-#undef __array_text
-#define __array_text(_type, _item, _length)                            \
-       __array(_type, _item, _length)
-
-#undef __dynamic_array
-#define __dynamic_array(_type, _item, _length)                         \
+#undef __dynamic_array_enc_ext
+#define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\
        goto __assign_##_item##_1;                                      \
 __end_field_##_item##_1:                                               \
        goto __assign_##_item##_2;                                      \
 __end_field_##_item##_2:
 
-#undef __dynamic_array_text
-#define __dynamic_array_text(_type, _item, _length)                    \
-       __dynamic_array(_type, _item, _length)
-
 #undef __string
 #define __string(_item, _src)                                          \
        goto __assign_##_item;                                          \
This page took 0.034813 seconds and 4 git commands to generate.