--- /dev/null
+/*
+ * Copyright (c) 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ */
+
+#undef ctf_integer_nowrite
+#define ctf_integer_nowrite(_type, _item, _src) \
+ _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, 0)
+
+#undef ctf_float_nowrite
+#define ctf_float_nowrite(_type, _item, _src) \
+ _ctf_float_nowrite(_type, _item, _src, 0)
+
+#undef ctf_array_nowrite
+#define ctf_array_nowrite(_type, _item, _src, _length) \
+ _ctf_array_encoded(_type, _item, _src, _length, none, 0)
+
+#undef ctf_array_text_nowrite
+#define ctf_array_text_nowrite(_type, _item, _src, _length) \
+ _ctf_array_encoded(_type, _item, _src, _length, UTF8, 0)
+
+#undef ctf_sequence_nowrite
+#define ctf_sequence_nowrite(_type, _item, _src, _length_type, _src_length) \
+ _ctf_sequence_encoded(_type, _item, _src, \
+ _length_type, _src_length, none, 0)
+
+#undef ctf_sequence_text_nowrite
+#define ctf_sequence_text_nowrite(_type, _item, _src, _length_type, _src_length) \
+ _ctf_sequence_encoded(_type, _item, _src, \
+ _length_type, _src_length, UTF8, 0)
+
+#undef ctf_string_nowrite
+#define ctf_string_nowrite(_item, _src) \
+ _ctf_string(_item, _src, 0)
#undef TP_FIELDS
#define TP_FIELDS(...)
-#undef ctf_integer_ext
-#define ctf_integer_ext(_type, _item, _src, _byte_order, _base)
+#undef TRACEPOINT_LOGLEVEL_ENUM
+#define TRACEPOINT_LOGLEVEL_ENUM(...)
+
+#undef TRACEPOINT_LOGLEVEL
+#define TRACEPOINT_LOGLEVEL(provider, name, loglevel)
+
+#undef _ctf_integer_ext
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, \
+ _written)
+
+#undef _ctf_float
+#define _ctf_float(_type, _item, _src, _written)
+
+#undef _ctf_array_encoded
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, \
+ _written)
+
+#undef _ctf_sequence_encoded
+#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
+ _src_length, _encoding, _written)
+
+#undef _ctf_string
+#define _ctf_string(_item, _src, _written)
+
+/* "write" */
+#undef ctf_integer
+#define ctf_integer(_type, _item, _src)
+
+#undef ctf_integer_hex
+#define ctf_integer_hex(_type, _item, _src)
+
+#undef ctf_integer_network
+#define ctf_integer_network(_type, _item, _src)
+
+#undef ctf_integer_network_hex
+#define ctf_integer_network_hex(_type, _item, _src)
#undef ctf_float
#define ctf_float(_type, _item, _src)
-#undef ctf_array_encoded
-#define ctf_array_encoded(_type, _item, _src, _length, _encoding)
+#undef ctf_array
+#define ctf_array(_type, _item, _src, _length)
+
+#undef ctf_array_text
+#define ctf_array_text(_type, _item, _src, _length)
+
+#undef ctf_sequence
+#define ctf_sequence(_type, _item, _src, _length_type, _src_length)
-#undef ctf_sequence_encoded
-#define ctf_sequence_encoded(_type, _item, _src, _length_type, \
- _src_length, _encoding)
+#undef ctf_sequence_text
+#define ctf_sequence_text(_type, _item, _src, _length_type, _src_length)
#undef ctf_string
#define ctf_string(_item, _src)
-#undef TRACEPOINT_LOGLEVEL_ENUM
-#define TRACEPOINT_LOGLEVEL_ENUM(...)
+/* "nowrite" */
+#undef ctf_integer_nowrite
+#define ctf_integer_nowrite(_type, _item, _src)
-#undef TRACEPOINT_LOGLEVEL
-#define TRACEPOINT_LOGLEVEL(provider, name, loglevel)
+#undef ctf_float_nowrite
+#define ctf_float_nowrite(_type, _item, _src)
+
+#undef ctf_array_nowrite
+#define ctf_array_nowrite(_type, _item, _src, _length)
+
+#undef ctf_array_text_nowrite
+#define ctf_array_text_nowrite(_type, _item, _src, _length)
+
+#undef ctf_sequence_nowrite
+#define ctf_sequence_nowrite(_type, _item, _src, _length_type, _src_length)
+
+#undef ctf_sequence_text_nowrite
+#define ctf_sequence_text_nowrite(_type, _item, _src, _length_type, _src_length)
+
+#undef ctf_string_nowrite
+#define ctf_string_nowrite(_item, _src)
--- /dev/null
+/*
+ * Copyright (c) 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ */
+
+#undef ctf_integer
+#define ctf_integer(_type, _item, _src) \
+ _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, 1)
+
+#undef ctf_integer_hex
+#define ctf_integer_hex(_type, _item, _src) \
+ _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 16, 1)
+
+#undef ctf_integer_network
+#define ctf_integer_network(_type, _item, _src) \
+ _ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 10, 1)
+
+#undef ctf_integer_network_hex
+#define ctf_integer_network_hex(_type, _item, _src) \
+ _ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 16, 1)
+
+#undef ctf_float
+#define ctf_float(_type, _item, _src) \
+ _ctf_float(_type, _item, _src, 1)
+
+#undef ctf_array
+#define ctf_array(_type, _item, _src, _length) \
+ _ctf_array_encoded(_type, _item, _src, _length, none, 1)
+
+#undef ctf_array_text
+#define ctf_array_text(_type, _item, _src, _length) \
+ _ctf_array_encoded(_type, _item, _src, _length, UTF8, 1)
+
+#undef ctf_sequence
+#define ctf_sequence(_type, _item, _src, _length_type, _src_length) \
+ _ctf_sequence_encoded(_type, _item, _src, \
+ _length_type, _src_length, none, 1)
+
+#undef ctf_sequence_text
+#define ctf_sequence_text(_type, _item, _src, _length_type, _src_length) \
+ _ctf_sequence_encoded(_type, _item, _src, \
+ _length_type, _src_length, UTF8, 1)
+
+#undef ctf_string
+#define ctf_string(_item, _src) \
+ _ctf_string(_item, _src, 1)
#include <lttng/ringbuffer-config.h>
#include <string.h>
-/*
- * Macro declarations used for all stages.
- */
-
-#undef ctf_integer
-#define ctf_integer(_type, _item, _src) \
- ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10)
-
-#undef ctf_integer_hex
-#define ctf_integer_hex(_type, _item, _src) \
- ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 16)
-
-#undef ctf_integer_network
-#define ctf_integer_network(_type, _item, _src) \
- ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 10)
-
-#undef ctf_integer_network_hex
-#define ctf_integer_network_hex(_type, _item, _src) \
- ctf_integer_ext(_type, _item, _src, BIG_ENDIAN, 16)
-
-/* ctf_float is redefined at each step */
-
-#undef ctf_array
-#define ctf_array(_type, _item, _src, _length) \
- ctf_array_encoded(_type, _item, _src, _length, none)
-
-#undef ctf_array_text
-#define ctf_array_text(_type, _item, _src, _length) \
- ctf_array_encoded(_type, _item, _src, _length, UTF8)
-
-#undef ctf_sequence
-#define ctf_sequence(_type, _item, _src, _length_type, _src_length) \
- ctf_sequence_encoded(_type, _item, _src, \
- _length_type, _src_length, none)
-
-#undef ctf_sequence_text
-#define ctf_sequence_text(_type, _item, _src, _length_type, _src_length) \
- ctf_sequence_encoded(_type, _item, _src, \
- _length_type, _src_length, UTF8)
-
-/* ctf_string is redefined at each step */
-
/*
* TRACEPOINT_EVENT_CLASS declares a class of tracepoints receiving the
* same arguments and having the same field layout.
/* Reset all macros within TRACEPOINT_EVENT */
#include <lttng/ust-tracepoint-event-reset.h>
+#include <lttng/ust-tracepoint-event-write.h>
+#include <lttng/ust-tracepoint-event-nowrite.h>
-#undef ctf_integer_ext
-#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \
+#undef _ctf_integer_ext
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
{ \
.name = #_item, \
.type = __type_integer(_type, _byte_order, _base, none),\
+ .written = _written, \
},
-#undef ctf_float
-#define ctf_float(_type, _item, _src) \
+#undef _ctf_float
+#define _ctf_float(_type, _item, _src, _written) \
{ \
.name = #_item, \
.type = __type_float(_type), \
+ .written = _written, \
},
-#undef ctf_array_encoded
-#define ctf_array_encoded(_type, _item, _src, _length, _encoding) \
+#undef _ctf_array_encoded
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
{ \
.name = #_item, \
.type = \
.elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \
}, \
}, \
+ .written = _written, \
},
-#undef ctf_sequence_encoded
-#define ctf_sequence_encoded(_type, _item, _src, \
- _length_type, _src_length, _encoding) \
+#undef _ctf_sequence_encoded
+#define _ctf_sequence_encoded(_type, _item, _src, \
+ _length_type, _src_length, _encoding, _written) \
{ \
.name = #_item, \
.type = \
.elem_type = __type_integer(_type, BYTE_ORDER, 10, _encoding), \
}, \
}, \
+ .written = _written, \
},
-#undef ctf_string
-#define ctf_string(_item, _src) \
+#undef _ctf_string
+#define _ctf_string(_item, _src, _written) \
{ \
.name = #_item, \
.type = \
.atype = atype_string, \
.u.basic.string.encoding = lttng_encode_UTF8, \
}, \
+ .written = _written, \
},
#undef TP_FIELDS
/* Reset all macros within TRACEPOINT_EVENT */
#include <lttng/ust-tracepoint-event-reset.h>
+#include <lttng/ust-tracepoint-event-write.h>
-#undef ctf_integer_ext
-#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \
+#undef _ctf_integer_ext
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
__event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
__event_len += sizeof(_type);
-#undef ctf_float
-#define ctf_float(_type, _item, _src) \
+#undef _ctf_float
+#define _ctf_float(_type, _item, _src, _written) \
__event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
__event_len += sizeof(_type);
-#undef ctf_array_encoded
-#define ctf_array_encoded(_type, _item, _src, _length, _encoding) \
+#undef _ctf_array_encoded
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
__event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
__event_len += sizeof(_type) * (_length);
-#undef ctf_sequence_encoded
-#define ctf_sequence_encoded(_type, _item, _src, _length_type, \
- _src_length, _encoding) \
+#undef _ctf_sequence_encoded
+#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
+ _src_length, _encoding, _written) \
__event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \
__event_len += sizeof(_length_type); \
__event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
__event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \
__dynamic_len_idx++;
-#undef ctf_string
-#define ctf_string(_item, _src) \
+#undef _ctf_string
+#define _ctf_string(_item, _src, _written) \
__event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1;
#undef TP_ARGS
* Stage 3.1 of tracepoint event generation.
*
* Create static inline function that layout the filter stack data.
+ * We make both write and nowrite data available to the filter.
*/
/* Reset all macros within TRACEPOINT_EVENT */
#include <lttng/ust-tracepoint-event-reset.h>
+#include <lttng/ust-tracepoint-event-write.h>
+#include <lttng/ust-tracepoint-event-nowrite.h>
-#undef ctf_integer_ext
-#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \
+#undef _ctf_integer_ext
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
if (lttng_is_signed_type(_type)) \
*(int64_t *) __stack_data = (int64_t) (_type) (_src); \
else \
*(uint64_t *) __stack_data = (uint64_t) (_type) (_src); \
__stack_data += sizeof(int64_t);
-#undef ctf_float
-#define ctf_float(_type, _item, _src) \
+#undef _ctf_float
+#define _ctf_float(_type, _item, _src, _written) \
*(double *) __stack_data = (double) (_type) (_src); \
__stack_data += sizeof(double);
-#undef ctf_array_encoded
-#define ctf_array_encoded(_type, _item, _src, _length, _encoding) \
+#undef _ctf_array_encoded
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
*(unsigned long *) __stack_data = (unsigned long) (_length); \
__stack_data += sizeof(unsigned long); \
*(const void **) __stack_data = (_src); \
__stack_data += sizeof(void *);
-#undef ctf_sequence_encoded
-#define ctf_sequence_encoded(_type, _item, _src, _length_type, \
- _src_length, _encoding) \
+#undef _ctf_sequence_encoded
+#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
+ _src_length, _encoding, _written) \
*(unsigned long *) __stack_data = (unsigned long) (_src_length); \
__stack_data += sizeof(unsigned long); \
*(const void **) __stack_data = (_src); \
__stack_data += sizeof(void *);
-#undef ctf_string
-#define ctf_string(_item, _src) \
+#undef _ctf_string
+#define _ctf_string(_item, _src, _written) \
*(const void **) __stack_data = (_src); \
__stack_data += sizeof(void *);
/* Reset all macros within TRACEPOINT_EVENT */
#include <lttng/ust-tracepoint-event-reset.h>
+#include <lttng/ust-tracepoint-event-write.h>
-#undef ctf_integer_ext
-#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \
+#undef _ctf_integer_ext
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
__event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
-#undef ctf_float
-#define ctf_float(_type, _item, _src) \
+#undef _ctf_float
+#define _ctf_float(_type, _item, _src, _written) \
__event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
-#undef ctf_array_encoded
-#define ctf_array_encoded(_type, _item, _src, _length, _encoding) \
+#undef _ctf_array_encoded
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
__event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
-#undef ctf_sequence_encoded
-#define ctf_sequence_encoded(_type, _item, _src, _length_type, \
- _src_length, _encoding) \
+#undef _ctf_sequence_encoded
+#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
+ _src_length, _encoding, _written) \
__event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_length_type)); \
__event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
-#undef ctf_string
-#define ctf_string(_item, _src)
+#undef _ctf_string
+#define _ctf_string(_item, _src, _written)
#undef TP_ARGS
#define TP_ARGS(...) __VA_ARGS__
/* Reset all macros within TRACEPOINT_EVENT */
#include <lttng/ust-tracepoint-event-reset.h>
+#include <lttng/ust-tracepoint-event-write.h>
-#undef ctf_integer_ext
-#define ctf_integer_ext(_type, _item, _src, _byte_order, _base) \
+#undef _ctf_integer_ext
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _written) \
{ \
_type __tmp = (_src); \
lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
__chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
}
-#undef ctf_float
-#define ctf_float(_type, _item, _src) \
+#undef _ctf_float
+#define _ctf_float(_type, _item, _src, _written) \
{ \
_type __tmp = (_src); \
lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
__chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
}
-#undef ctf_array_encoded
-#define ctf_array_encoded(_type, _item, _src, _length, _encoding) \
+#undef _ctf_array_encoded
+#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _written) \
lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
__chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length));
-#undef ctf_sequence_encoded
-#define ctf_sequence_encoded(_type, _item, _src, _length_type, \
- _src_length, _encoding) \
+#undef _ctf_sequence_encoded
+#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
+ _src_length, _encoding, _written) \
{ \
_length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \
lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
__chan->ops->event_write(&__ctx, _src, \
sizeof(_type) * __get_dynamic_len(dest));
-#undef ctf_string
-#define ctf_string(_item, _src) \
+#undef _ctf_string
+#define _ctf_string(_item, _src, _written) \
lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
__chan->ops->event_write(&__ctx, _src, __get_dynamic_len(dest));