From: Mathieu Desnoyers Date: Sun, 22 May 2011 15:56:51 +0000 (-0400) Subject: Update ring buffer and pretty print X-Git-Tag: v2.0-pre1~119 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=64c796d8aec1efa5d6f0d5850d2a0095cb7842e3;p=lttng-modules.git Update ring buffer and pretty print Now enforce using module-local lib ring buffer (there are changes that require it). Pretty print array and dynamic array containing text. Handle large event count. Signed-off-by: Mathieu Desnoyers --- diff --git a/Makefile b/Makefile index 8da265d5..d2d6cbab 100644 --- a/Makefile +++ b/Makefile @@ -14,12 +14,7 @@ ltt-relay-objs := ltt-events.o ltt-debugfs-abi.o \ ltt-probes.o ltt-core.o obj-m += probes/ - -# Use externally packaged lib ring buffer if missing in kernel -ifneq ($(CONFIG_LIB_RING_BUFFER),) -else obj-m += lib/ -endif endif diff --git a/instrumentation/events/lttng-module/block.h b/instrumentation/events/lttng-module/block.h index 3c75e4f4..1c48384e 100644 --- a/instrumentation/events/lttng-module/block.h +++ b/instrumentation/events/lttng-module/block.h @@ -58,7 +58,7 @@ DECLARE_EVENT_CLASS(block_rq_with_error, __field( unsigned int, nr_sector ) __field( int, errors ) __field( unsigned int, rwbs ) - __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) + __dynamic_array_text( char, cmd, blk_cmd_buf_len(rq) ) ), TP_fast_assign( @@ -144,8 +144,8 @@ DECLARE_EVENT_CLASS(block_rq, __field( unsigned int, nr_sector ) __field( unsigned int, bytes ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) - __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) + __array_text( char, comm, TASK_COMM_LEN ) + __dynamic_array_text( char, cmd, blk_cmd_buf_len(rq) ) ), TP_fast_assign( @@ -225,7 +225,7 @@ TRACE_EVENT(block_bio_bounce, __field( sector_t, sector ) __field( unsigned int, nr_sector ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -293,7 +293,7 @@ DECLARE_EVENT_CLASS(block_bio, __field( sector_t, sector ) __field( unsigned int, nr_sector ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -366,7 +366,7 @@ DECLARE_EVENT_CLASS(block_get_rq, __field( sector_t, sector ) __field( unsigned int, nr_sector ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -434,7 +434,7 @@ TRACE_EVENT(block_plug, TP_ARGS(q), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -452,7 +452,7 @@ DECLARE_EVENT_CLASS(block_unplug, TP_STRUCT__entry( __field( int, nr_rq ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( @@ -502,7 +502,7 @@ TRACE_EVENT(block_split, __field( sector_t, sector ) __field( sector_t, new_sector ) __field( unsigned int, rwbs ) - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) ), TP_fast_assign( diff --git a/instrumentation/events/lttng-module/lttng.h b/instrumentation/events/lttng-module/lttng.h index 2d40188a..4cc14fc5 100644 --- a/instrumentation/events/lttng-module/lttng.h +++ b/instrumentation/events/lttng-module/lttng.h @@ -12,6 +12,11 @@ TRACE_EVENT(lttng_metadata, TP_ARGS(str), + /* + * Not exactly a string: more a sequence of bytes (dynamic + * array) without the length. This is a dummy anyway: we only + * use this declaration to generate an event metadata entry. + */ TP_STRUCT__entry( __string( str, str ) ), diff --git a/instrumentation/events/lttng-module/sched.h b/instrumentation/events/lttng-module/sched.h index 4d618445..37debc3c 100644 --- a/instrumentation/events/lttng-module/sched.h +++ b/instrumentation/events/lttng-module/sched.h @@ -37,7 +37,7 @@ TRACE_EVENT(sched_kthread_stop, TP_ARGS(t), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) __field( pid_t, pid ) ), @@ -79,7 +79,7 @@ DECLARE_EVENT_CLASS(sched_wakeup_template, TP_ARGS(p, success), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) __field( pid_t, pid ) __field( int, prio ) __field( int, success ) @@ -121,11 +121,11 @@ TRACE_EVENT(sched_switch, TP_ARGS(prev, next), TP_STRUCT__entry( - __array( char, prev_comm, TASK_COMM_LEN ) + __array_text( char, prev_comm, TASK_COMM_LEN ) __field( pid_t, prev_pid ) __field( int, prev_prio ) __field( long, prev_state ) - __array( char, next_comm, TASK_COMM_LEN ) + __array_text( char, next_comm, TASK_COMM_LEN ) __field( pid_t, next_pid ) __field( int, next_prio ) ), @@ -160,7 +160,7 @@ TRACE_EVENT(sched_migrate_task, TP_ARGS(p, dest_cpu), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) __field( pid_t, pid ) __field( int, prio ) __field( int, orig_cpu ) @@ -187,7 +187,7 @@ DECLARE_EVENT_CLASS(sched_process_template, TP_ARGS(p), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) __field( pid_t, pid ) __field( int, prio ) ), @@ -234,7 +234,7 @@ TRACE_EVENT(sched_process_wait, TP_ARGS(pid), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) __field( pid_t, pid ) __field( int, prio ) ), @@ -259,9 +259,9 @@ TRACE_EVENT(sched_process_fork, TP_ARGS(parent, child), TP_STRUCT__entry( - __array( char, parent_comm, TASK_COMM_LEN ) + __array_text( char, parent_comm, TASK_COMM_LEN ) __field( pid_t, parent_pid ) - __array( char, child_comm, TASK_COMM_LEN ) + __array_text( char, child_comm, TASK_COMM_LEN ) __field( pid_t, child_pid ) ), @@ -288,7 +288,7 @@ DECLARE_EVENT_CLASS(sched_stat_template, TP_ARGS(tsk, delay), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) __field( pid_t, pid ) __field( u64, delay ) ), @@ -343,7 +343,7 @@ TRACE_EVENT(sched_stat_runtime, TP_ARGS(tsk, runtime, vruntime), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) __field( pid_t, pid ) __field( u64, runtime ) __field( u64, vruntime ) @@ -376,7 +376,7 @@ TRACE_EVENT(sched_pi_setprio, TP_ARGS(tsk, newprio), TP_STRUCT__entry( - __array( char, comm, TASK_COMM_LEN ) + __array_text( char, comm, TASK_COMM_LEN ) __field( pid_t, pid ) __field( int, oldprio ) __field( int, newprio ) diff --git a/lib/ringbuffer/config.h b/lib/ringbuffer/config.h index 5a9f8962..770f692c 100644 --- a/lib/ringbuffer/config.h +++ b/lib/ringbuffer/config.h @@ -33,9 +33,7 @@ struct lib_ring_buffer_client_cb { u64 (*ring_buffer_clock_read) (struct channel *chan); size_t (*record_header_size) (const struct lib_ring_buffer_config *config, struct channel *chan, size_t offset, - size_t data_size, size_t *pre_header_padding, - unsigned int rflags, struct lib_ring_buffer_ctx *ctx); /* Slow path only, at subbuffer switch */ @@ -210,6 +208,7 @@ void lib_ring_buffer_ctx_init(struct lib_ring_buffer_ctx *ctx, ctx->data_size = data_size; ctx->largest_align = largest_align; ctx->cpu = cpu; + ctx->rflags = 0; } /* diff --git a/lib/ringbuffer/frontend_api.h b/lib/ringbuffer/frontend_api.h index 8a58ace4..391e5937 100644 --- a/lib/ringbuffer/frontend_api.h +++ b/lib/ringbuffer/frontend_api.h @@ -93,14 +93,13 @@ int lib_ring_buffer_try_reserve(const struct lib_ring_buffer_config *config, prefetch(&buf->commit_hot[subbuf_index(*o_begin, chan)]); if (last_tsc_overflow(config, buf, ctx->tsc)) - ctx->rflags = RING_BUFFER_RFLAG_FULL_TSC; + ctx->rflags |= RING_BUFFER_RFLAG_FULL_TSC; if (unlikely(subbuf_offset(*o_begin, chan) == 0)) return 1; ctx->slot_size = record_header_size(config, chan, *o_begin, - ctx->data_size, before_hdr_pad, - ctx->rflags, ctx); + before_hdr_pad, ctx); ctx->slot_size += lib_ring_buffer_align(*o_begin + ctx->slot_size, ctx->largest_align) + ctx->data_size; diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c index 7d4dd838..1931414b 100644 --- a/lib/ringbuffer/ring_buffer_frontend.c +++ b/lib/ringbuffer/ring_buffer_frontend.c @@ -1510,16 +1510,15 @@ int lib_ring_buffer_try_reserve_slow(struct lib_ring_buffer *buf, return -EIO; if (last_tsc_overflow(config, buf, ctx->tsc)) - ctx->rflags = RING_BUFFER_RFLAG_FULL_TSC; + ctx->rflags |= RING_BUFFER_RFLAG_FULL_TSC; if (unlikely(subbuf_offset(offsets->begin, ctx->chan) == 0)) { offsets->switch_new_start = 1; /* For offsets->begin */ } else { offsets->size = config->cb.record_header_size(config, chan, offsets->begin, - ctx->data_size, &offsets->pre_header_padding, - ctx->rflags, ctx); + ctx); offsets->size += lib_ring_buffer_align(offsets->begin + offsets->size, ctx->largest_align) @@ -1582,9 +1581,8 @@ int lib_ring_buffer_try_reserve_slow(struct lib_ring_buffer *buf, offsets->size = config->cb.record_header_size(config, chan, offsets->begin, - ctx->data_size, &offsets->pre_header_padding, - ctx->rflags, ctx); + ctx); offsets->size += lib_ring_buffer_align(offsets->begin + offsets->size, ctx->largest_align) diff --git a/ltt-events.h b/ltt-events.h index 859b43b7..6cc37531 100644 --- a/ltt-events.h +++ b/ltt-events.h @@ -45,7 +45,7 @@ struct lttng_enum_entry { const char *string; }; -#define __type_integer(_type, _byte_order, _base) \ +#define __type_integer(_type, _byte_order, _base, _encoding) \ { \ .atype = atype_integer, \ .u.basic.integer = \ @@ -55,7 +55,7 @@ struct lttng_enum_entry { .signedness = is_signed_type(_type), \ .reverse_byte_order = _byte_order != __BYTE_ORDER, \ .base = _base, \ - .encoding = lttng_encode_none, \ + .encoding = lttng_encode_##_encoding, \ }, \ } \ @@ -181,7 +181,7 @@ struct ltt_channel_ops { struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan); void (*buffer_read_close)(struct lib_ring_buffer *buf); int (*event_reserve)(struct lib_ring_buffer_ctx *ctx, - uint16_t event_id); + uint32_t event_id); void (*event_commit)(struct lib_ring_buffer_ctx *ctx); void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src, size_t len); diff --git a/ltt-ring-buffer-client.h b/ltt-ring-buffer-client.h index e7bc4329..8ba4a735 100644 --- a/ltt-ring-buffer-client.h +++ b/ltt-ring-buffer-client.h @@ -60,9 +60,7 @@ static inline notrace u64 lib_ring_buffer_clock_read(struct channel *chan) * @config: ring buffer instance configuration * @chan: channel * @offset: offset in the write buffer - * @data_size: size of the payload * @pre_header_padding: padding to add before the header (output) - * @rflags: reservation flags * @ctx: reservation context * * Returns the event header size (including padding). @@ -73,8 +71,7 @@ static inline notrace u64 lib_ring_buffer_clock_read(struct channel *chan) static __inline__ unsigned char record_header_size(const struct lib_ring_buffer_config *config, struct channel *chan, size_t offset, - size_t data_size, size_t *pre_header_padding, - unsigned int rflags, + size_t *pre_header_padding, struct lib_ring_buffer_ctx *ctx) { struct ltt_channel *ltt_chan = channel_get_private(chan); @@ -85,7 +82,7 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config, case 1: /* compact */ padding = lib_ring_buffer_align(offset, ltt_alignof(uint32_t)); offset += padding; - if (!(rflags & RING_BUFFER_RFLAG_FULL_TSC)) { + if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTT_RFLAG_EXTENDED))) { offset += sizeof(uint32_t); /* id and timestamp */ } else { /* Minimum space taken by 5-bit id */ @@ -101,7 +98,7 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config, padding = lib_ring_buffer_align(offset, ltt_alignof(uint16_t)); offset += padding; offset += sizeof(uint16_t); - if (!(rflags & RING_BUFFER_RFLAG_FULL_TSC)) { + if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTT_RFLAG_EXTENDED))) { offset += lib_ring_buffer_align(offset, ltt_alignof(uint32_t)); offset += sizeof(uint32_t); /* timestamp */ } else { @@ -114,7 +111,7 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config, } break; default: - WARN_ON(1); + WARN_ON_ONCE(1); } *pre_header_padding = padding; @@ -126,7 +123,7 @@ unsigned char record_header_size(const struct lib_ring_buffer_config *config, extern void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config, struct lib_ring_buffer_ctx *ctx, - uint16_t event_id); + uint32_t event_id); /* * ltt_write_event_header @@ -140,7 +137,7 @@ void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config, static __inline__ void ltt_write_event_header(const struct lib_ring_buffer_config *config, struct lib_ring_buffer_ctx *ctx, - uint16_t event_id) + uint32_t event_id) { struct ltt_channel *ltt_chan = channel_get_private(ctx->chan); @@ -167,7 +164,7 @@ void ltt_write_event_header(const struct lib_ring_buffer_config *config, break; } default: - WARN_ON(1); + WARN_ON_ONCE(1); } return; @@ -175,18 +172,15 @@ slow_path: ltt_write_event_header_slow(config, ctx, event_id); } -/* - * TODO: For now, we only support 65536 event ids per channel. - */ void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer_ctx *ctx, - uint16_t event_id) + struct lib_ring_buffer_ctx *ctx, + uint32_t event_id) { struct ltt_channel *ltt_chan = channel_get_private(ctx->chan); switch (ltt_chan->header_type) { case 1: /* compact */ - if (!(ctx->rflags & RING_BUFFER_RFLAG_FULL_TSC)) { + if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTT_RFLAG_EXTENDED))) { uint32_t id_time = 0; bt_bitfield_write(&id_time, uint32_t, 0, 5, event_id); @@ -208,28 +202,27 @@ void ltt_write_event_header_slow(const struct lib_ring_buffer_config *config, break; case 2: /* large */ { - if (!(ctx->rflags & RING_BUFFER_RFLAG_FULL_TSC)) { + if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTT_RFLAG_EXTENDED))) { uint32_t timestamp = (uint32_t) ctx->tsc; lib_ring_buffer_write(config, ctx, &event_id, sizeof(event_id)); lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint32_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); } else { - uint16_t event_id = 65535; - uint32_t event_id_ext = (uint32_t) event_id; + uint16_t id = 65535; uint64_t timestamp = ctx->tsc; - lib_ring_buffer_write(config, ctx, &event_id, sizeof(event_id)); + lib_ring_buffer_write(config, ctx, &id, sizeof(id)); /* Align extended struct on largest member */ lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t)); - lib_ring_buffer_write(config, ctx, &event_id_ext, sizeof(event_id_ext)); + lib_ring_buffer_write(config, ctx, &event_id, sizeof(event_id)); lib_ring_buffer_align_ctx(ctx, ltt_alignof(uint64_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); } break; } default: - WARN_ON(1); + WARN_ON_ONCE(1); } } @@ -243,13 +236,11 @@ static u64 client_ring_buffer_clock_read(struct channel *chan) static size_t client_record_header_size(const struct lib_ring_buffer_config *config, struct channel *chan, size_t offset, - size_t data_size, size_t *pre_header_padding, - unsigned int rflags, struct lib_ring_buffer_ctx *ctx) { - return record_header_size(config, chan, offset, data_size, - pre_header_padding, rflags, ctx); + return record_header_size(config, chan, offset, + pre_header_padding, ctx); } /** @@ -380,8 +371,9 @@ void ltt_buffer_read_close(struct lib_ring_buffer *buf) static int ltt_event_reserve(struct lib_ring_buffer_ctx *ctx, - uint16_t event_id) + uint32_t event_id) { + struct ltt_channel *ltt_chan = channel_get_private(ctx->chan); int ret, cpu; cpu = lib_ring_buffer_get_cpu(&client_config); @@ -389,6 +381,19 @@ int ltt_event_reserve(struct lib_ring_buffer_ctx *ctx, return -EPERM; ctx->cpu = cpu; + switch (ltt_chan->header_type) { + case 1: /* compact */ + if (event_id > 30) + ctx->rflags |= LTT_RFLAG_EXTENDED; + break; + case 2: /* large */ + if (event_id > 65534) + ctx->rflags |= LTT_RFLAG_EXTENDED; + break; + default: + WARN_ON_ONCE(1); + } + ret = lib_ring_buffer_reserve(&client_config, ctx); if (ret) goto put; diff --git a/ltt-ring-buffer-metadata-client.h b/ltt-ring-buffer-metadata-client.h index 17207f27..136af200 100644 --- a/ltt-ring-buffer-metadata-client.h +++ b/ltt-ring-buffer-metadata-client.h @@ -41,8 +41,7 @@ u64 lib_ring_buffer_clock_read(struct channel *chan) static inline unsigned char record_header_size(const struct lib_ring_buffer_config *config, struct channel *chan, size_t offset, - size_t data_size, size_t *pre_header_padding, - unsigned int rflags, + size_t *pre_header_padding, struct lib_ring_buffer_ctx *ctx) { return 0; @@ -187,7 +186,7 @@ void ltt_buffer_read_close(struct lib_ring_buffer *buf) } static -int ltt_event_reserve(struct lib_ring_buffer_ctx *ctx, uint16_t event_id) +int ltt_event_reserve(struct lib_ring_buffer_ctx *ctx, uint32_t event_id) { return lib_ring_buffer_reserve(&client_config, ctx); } diff --git a/ltt-tracer.h b/ltt-tracer.h index 8c0d12d4..b4e18f71 100644 --- a/ltt-tracer.h +++ b/ltt-tracer.h @@ -128,6 +128,9 @@ enum ltt_channels { */ #define LTT_RESERVE_CRITICAL 4096 +#define LTT_RFLAG_EXTENDED RING_BUFFER_RFLAG_END +#define LTT_RFLAG_END (LTT_RFLAG_EXTENDED << 1) + /* Register and unregister function pointers */ enum ltt_module_function { diff --git a/probes/lttng-events.h b/probes/lttng-events.h index 422f9590..9aaf1573 100644 --- a/probes/lttng-events.h +++ b/probes/lttng-events.h @@ -78,7 +78,7 @@ void trace_##_name(_proto); #define __field(_type, _item) \ { \ .name = #_item, \ - .type = __type_integer(_type, __BYTE_ORDER, 10), \ + .type = __type_integer(_type, __BYTE_ORDER, 10, none),\ }, #undef __field_ext @@ -88,11 +88,11 @@ void trace_##_name(_proto); #define __field_network(_type, _item) \ { \ .name = #_item, \ - .type = __type_integer(_type, __BIG_ENDIAN, 10), \ + .type = __type_integer(_type, __BIG_ENDIAN, 10, none),\ }, -#undef __array -#define __array(_type, _item, _length) \ +#undef __array_enc +#define __array_enc(_type, _item, _length, _encoding) \ { \ .name = #_item, \ .type = \ @@ -101,13 +101,21 @@ void trace_##_name(_proto); .u.array = \ { \ .length = _length, \ - .elem_type = __type_integer(_type, __BYTE_ORDER, 10), \ + .elem_type = __type_integer(_type, __BYTE_ORDER, 10, _encoding), \ }, \ }, \ }, -#undef __dynamic_array -#define __dynamic_array(_type, _item, _length) \ +#undef __array +#define __array(_type, _item, _length) \ + __array_enc(_type, _item, _length, none) + +#undef __array_text +#define __array_text(_type, _item, _length) \ + __array_enc(_type, _item, _length, UTF8) + +#undef __dynamic_array_enc +#define __dynamic_array_enc(_type, _item, _length, _encoding) \ { \ .name = #_item, \ .type = \ @@ -115,12 +123,20 @@ void trace_##_name(_proto); .atype = atype_sequence, \ .u.sequence = \ { \ - .length_type = __type_integer(u32, __BYTE_ORDER, 10), \ - .elem_type = __type_integer(_type, __BYTE_ORDER, 10), \ + .length_type = __type_integer(u32, __BYTE_ORDER, 10, none), \ + .elem_type = __type_integer(_type, __BYTE_ORDER, 10, _encoding), \ }, \ }, \ }, +#undef __dynamic_array +#define __dynamic_array(_type, _item, _length) \ + __dynamic_array_enc(_type, _item, _length, none) + +#undef __dynamic_array_text +#define __dynamic_array_text(_type, _item, _length) \ + __dynamic_array_enc(_type, _item, _length, UTF8) + #undef __string #define __string(_item, _src) \ { \ @@ -233,6 +249,10 @@ static struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = { __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) \ __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(u32)); \ @@ -240,6 +260,10 @@ static struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = { __event_len += lib_ring_buffer_align(__event_len, ltt_alignof(_type)); \ __event_len += sizeof(_type) * (_length); +#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; @@ -286,11 +310,19 @@ static inline size_t __event_get_size__##_name(size_t *__dynamic_len, _proto) \ #define __array(_type, _item, _length) \ __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) \ __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) @@ -332,9 +364,17 @@ static inline size_t __event_get_align__##_name(_proto) \ #undef __array #define __array(_type, _item, _length) _type _item; +#undef __array_text +#define __array_text(_type, _item, _length) \ + __array(_type, _item, _length) + #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 __string #define __string(_item, _src) char _item; @@ -376,6 +416,10 @@ __end_field_##_item: 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) \ goto __assign_##_item##_1; \ @@ -383,6 +427,10 @@ __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; \ diff --git a/probes/lttng-types.h b/probes/lttng-types.h index 75853ee6..cec2739e 100644 --- a/probes/lttng-types.h +++ b/probes/lttng-types.h @@ -46,7 +46,7 @@ #define TRACE_EVENT_TYPE___enum(_name, _container_type) \ { \ .name = #_name, \ - .container_type = __type_integer(_container_type, __BYTE_ORDER, 10), \ + .container_type = __type_integer(_container_type, __BYTE_ORDER, 10, none), \ .entries = __trace_event_enum_##_name, \ .len = ARRAY_SIZE(__trace_event_enum_##_name), \ },