From: Mathieu Desnoyers Date: Fri, 6 May 2016 18:32:45 +0000 (-0400) Subject: Tracepoint: add ctf sequence for network byte order integers X-Git-Tag: v2.9.0-rc1~126 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=48d660d146a6c8c7c8a54a183faac7d493deb32b;p=lttng-ust.git Tracepoint: add ctf sequence for network byte order integers Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/ust-tracepoint-event-nowrite.h b/include/lttng/ust-tracepoint-event-nowrite.h index 8cb142b2..83a9c93e 100644 --- a/include/lttng/ust-tracepoint-event-nowrite.h +++ b/include/lttng/ust-tracepoint-event-nowrite.h @@ -38,17 +38,17 @@ #undef ctf_sequence_nowrite #define ctf_sequence_nowrite(_type, _item, _src, _length_type, _src_length) \ - _ctf_sequence_encoded(_type, _item, _src, \ + _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \ _length_type, _src_length, none, 1, 10) #undef ctf_sequence_nowrite_hex #define ctf_sequence_nowrite_hex(_type, _item, _src, _length_type, _src_length) \ - _ctf_sequence_encoded(_type, _item, _src, \ + _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \ _length_type, _src_length, none, 1, 16) #undef ctf_sequence_text_nowrite #define ctf_sequence_text_nowrite(_type, _item, _src, _length_type, _src_length) \ - _ctf_sequence_encoded(_type, _item, _src, \ + _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \ _length_type, _src_length, UTF8, 1, 10) #undef ctf_string_nowrite diff --git a/include/lttng/ust-tracepoint-event-reset.h b/include/lttng/ust-tracepoint-event-reset.h index c187061c..7852bd8b 100644 --- a/include/lttng/ust-tracepoint-event-reset.h +++ b/include/lttng/ust-tracepoint-event-reset.h @@ -58,7 +58,7 @@ _nowrite) #undef _ctf_sequence_encoded -#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ +#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \ _src_length, _encoding, _nowrite, _elem_type_base) #undef _ctf_string diff --git a/include/lttng/ust-tracepoint-event-write.h b/include/lttng/ust-tracepoint-event-write.h index 444702fc..faf26e2c 100644 --- a/include/lttng/ust-tracepoint-event-write.h +++ b/include/lttng/ust-tracepoint-event-write.h @@ -50,17 +50,27 @@ #undef ctf_sequence #define ctf_sequence(_type, _item, _src, _length_type, _src_length) \ - _ctf_sequence_encoded(_type, _item, _src, \ + _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \ _length_type, _src_length, none, 0, 10) #undef ctf_sequence_hex #define ctf_sequence_hex(_type, _item, _src, _length_type, _src_length) \ - _ctf_sequence_encoded(_type, _item, _src, \ + _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \ + _length_type, _src_length, none, 0, 16) + +#undef ctf_sequence_network +#define ctf_sequence_network(_type, _item, _src, _length_type, _src_length) \ + _ctf_sequence_encoded(_type, _item, _src, BIG_ENDIAN, \ + _length_type, _src_length, none, 0, 10) + +#undef ctf_sequence_network_hex +#define ctf_sequence_network_hex(_type, _item, _src, _length_type, _src_length) \ + _ctf_sequence_encoded(_type, _item, _src, BIG_ENDIAN, \ _length_type, _src_length, none, 0, 16) #undef ctf_sequence_text #define ctf_sequence_text(_type, _item, _src, _length_type, _src_length) \ - _ctf_sequence_encoded(_type, _item, _src, \ + _ctf_sequence_encoded(_type, _item, _src, BYTE_ORDER, \ _length_type, _src_length, UTF8, 0, 10) #undef ctf_string diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index e914d97e..2b599a88 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -221,7 +221,7 @@ static const char \ }, #undef _ctf_sequence_encoded -#define _ctf_sequence_encoded(_type, _item, _src, \ +#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, \ _length_type, _src_length, _encoding, _nowrite, \ _elem_type_base) \ { \ @@ -234,7 +234,7 @@ static const char \ .sequence = \ { \ .length_type = __type_integer(_length_type, BYTE_ORDER, 10, none), \ - .elem_type = __type_integer(_type, BYTE_ORDER, _elem_type_base, _encoding), \ + .elem_type = __type_integer(_type, _byte_order, _elem_type_base, _encoding), \ }, \ }, \ }, \ @@ -344,7 +344,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); __event_len += sizeof(_type) * (_length); #undef _ctf_sequence_encoded -#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ +#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \ _src_length, _encoding, _nowrite, _elem_type_base) \ __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \ __event_len += sizeof(_length_type); \ @@ -497,7 +497,7 @@ size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS } #undef _ctf_sequence_encoded -#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ +#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \ _src_length, _encoding, _nowrite, _elem_type_base) \ { \ unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \ @@ -561,7 +561,7 @@ void __event_prepare_filter_stack__##_provider##___##_name(char *__stack_data,\ __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, \ +#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \ _src_length, _encoding, _nowrite, _elem_type_base) \ __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)); @@ -627,7 +627,7 @@ size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \ __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); #undef _ctf_sequence_encoded -#define _ctf_sequence_encoded(_type, _item, _src, _length_type, \ +#define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \ _src_length, _encoding, _nowrite, _elem_type_base) \ { \ _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \ diff --git a/tests/hello/ust_tests_hello.h b/tests/hello/ust_tests_hello.h index e518b0d4..84a799a0 100644 --- a/tests/hello/ust_tests_hello.h +++ b/tests/hello/ust_tests_hello.h @@ -46,6 +46,8 @@ TRACEPOINT_EVENT(ust_tests_hello, tptest, size_t, textlen) ctf_sequence_text(char, seqfield2, text, size_t, textlen) + ctf_sequence_network(long, seqfield_network_3, values, + size_t, 3) ctf_string(stringfield, text) ctf_float(float, floatfield, floatarg) ctf_float(double, doublefield, doublearg)