Update ring buffer and pretty print
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 22 May 2011 15:56:51 +0000 (11:56 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 22 May 2011 15:56:51 +0000 (11:56 -0400)
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 <mathieu.desnoyers@efficios.com>
13 files changed:
Makefile
instrumentation/events/lttng-module/block.h
instrumentation/events/lttng-module/lttng.h
instrumentation/events/lttng-module/sched.h
lib/ringbuffer/config.h
lib/ringbuffer/frontend_api.h
lib/ringbuffer/ring_buffer_frontend.c
ltt-events.h
ltt-ring-buffer-client.h
ltt-ring-buffer-metadata-client.h
ltt-tracer.h
probes/lttng-events.h
probes/lttng-types.h

index 8da265d5e54da460b46200e74bf1f23ce0267539..d2d6cbabe15cd6adc5a38f4b3a496a15f39e3e06 100644 (file)
--- 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
 
index 3c75e4f49863b8fb106ea91c32f1711dc67fcdde..1c48384ef240fc0b9ac59605debf78fe5dd07d43 100644 (file)
@@ -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(
index 2d40188a644199a7fa1e5105da2faba7d1aca82d..4cc14fc58a5dcb2902f0c7bc94c66fabd3233534 100644 (file)
@@ -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     )
        ),
index 4d61844562a60cb82fb6787bb53cd2a88a39a4cf..37debc3c385164db2075c7ffce3e00bdd08d3689 100644 (file)
@@ -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                 )
index 5a9f8962070e49af5884bdb2e0478e9f5bdc07ba..770f692ca0eabce233c4a2e4803e788a9355d7ce 100644 (file)
@@ -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;
 }
 
 /*
index 8a58ace456ad29ab3235484ec52a01e15bc6e6d3..391e59377905f846b8003d2fc94fd59508198751 100644 (file)
@@ -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;
index 7d4dd8380638adf09262fbe30ddd55b34a486c65..1931414b067a4c8836b1cece70be5c5ad45ad8a7 100644 (file)
@@ -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)
index 859b43b7b6e7feca15f28940b0bada2cb2d2d6f1..6cc3753101fb1606de8f1c11fe1f81c504c7553b 100644 (file)
@@ -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);
index e7bc4329f40e2f75a7f8b5e904424e3b4006dc9a..8ba4a735f10e7bf71f306f7f720df279a7cc9de3 100644 (file)
@@ -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, &timestamp, 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, &timestamp, 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;
index 17207f27ab928a929ec0a25cdb5a1cb5069ec84a..136af200c5bdc889c7ce72403e0a64e70d9d1b9d 100644 (file)
@@ -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);
 }
index 8c0d12d4ce418dfcd278ee974ea9695fc055c2eb..b4e18f717bd54b300f0bd906d35b3fd21561b76b 100644 (file)
@@ -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 {
index 422f959018c47c2d05d5c91bb2e328797854cf4a..9aaf1573b2576742faa6d79d1e197e1dcfa430fa 100644 (file)
@@ -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;                                          \
index 75853ee63319ccd28e0eb41ec9182a4ae9517b2a..cec2739e69fa540e1f62229b5952ccbb6f4e90c9 100644 (file)
@@ -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), \
                },
This page took 0.045615 seconds and 4 git commands to generate.