Add stream instance id to the packet header
[lttng-ust.git] / liblttng-ust / lttng-ring-buffer-client.h
index 70235b8a812508bebdee4c456a312a8f0ce6a4dc..536a31a8db7591a8c78b291fbad7f3143485f355 100644 (file)
@@ -45,6 +45,7 @@ struct packet_header {
                                         */
        uint8_t uuid[LTTNG_UST_UUID_LEN];
        uint32_t stream_id;
+       uint64_t stream_instance_id;
 
        struct {
                /* Stream packet context */
@@ -78,7 +79,7 @@ size_t ctx_get_size(size_t offset, struct lttng_ctx *ctx)
                return 0;
        offset += lib_ring_buffer_align(offset, ctx->largest_align);
        for (i = 0; i < ctx->nr_fields; i++)
-               offset += ctx->fields[i].get_size(offset);
+               offset += ctx->fields[i].get_size(&ctx->fields[i], offset);
        return offset - orig_offset;
 }
 
@@ -110,7 +111,7 @@ void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx,
  * contains.
  */
 static __inline__
-unsigned char record_header_size(const struct lttng_ust_lib_ring_buffer_config *config,
+size_t record_header_size(const struct lttng_ust_lib_ring_buffer_config *config,
                                 struct channel *chan, size_t offset,
                                 size_t *pre_header_padding,
                                 struct lttng_ust_lib_ring_buffer_ctx *ctx)
@@ -185,7 +186,7 @@ void lttng_write_event_header(const struct lttng_ust_lib_ring_buffer_config *con
                            uint32_t event_id)
 {
        struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
-       struct lttng_event *event = ctx->priv;
+       struct lttng_stack_ctx *lttng_ctx = ctx->priv2;
 
        if (caa_unlikely(ctx->rflags))
                goto slow_path;
@@ -220,8 +221,8 @@ void lttng_write_event_header(const struct lttng_ust_lib_ring_buffer_config *con
                WARN_ON_ONCE(1);
        }
 
-       ctx_record(ctx, lttng_chan, lttng_chan->ctx);
-       ctx_record(ctx, lttng_chan, event->ctx);
+       ctx_record(ctx, lttng_chan, lttng_ctx->chan_ctx);
+       ctx_record(ctx, lttng_chan, lttng_ctx->event_ctx);
        lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
 
        return;
@@ -236,7 +237,7 @@ void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config
                                 uint32_t event_id)
 {
        struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
-       struct lttng_event *event = ctx->priv;
+       struct lttng_stack_ctx *lttng_ctx = ctx->priv2;
 
        switch (lttng_chan->header_type) {
        case 1: /* compact */
@@ -293,8 +294,8 @@ void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config
        default:
                WARN_ON_ONCE(1);
        }
-       ctx_record(ctx, lttng_chan, lttng_chan->ctx);
-       ctx_record(ctx, lttng_chan, event->ctx);
+       ctx_record(ctx, lttng_chan, lttng_ctx->chan_ctx);
+       ctx_record(ctx, lttng_chan, lttng_ctx->event_ctx);
        lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
 }
 
@@ -345,6 +346,7 @@ static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, uint64_t
        header->magic = CTF_MAGIC_NUMBER;
        memcpy(header->uuid, lttng_chan->uuid, sizeof(lttng_chan->uuid));
        header->stream_id = lttng_chan->id;
+       header->stream_instance_id = buf->backend.cpu;
        header->ctx.timestamp_begin = tsc;
        header->ctx.timestamp_end = 0;
        header->ctx.content_size = ~0ULL; /* for debugging */
This page took 0.030814 seconds and 4 git commands to generate.