*/
uint8_t uuid[LTTNG_UST_UUID_LEN];
uint32_t stream_id;
+ uint64_t stream_instance_id;
struct {
/* Stream packet context */
uint64_t timestamp_end; /* Cycle count at subbuffer end */
uint64_t content_size; /* Size of data in subbuffer */
uint64_t packet_size; /* Subbuffer size (include padding) */
+ uint64_t packet_seq_num; /* Packet sequence number */
unsigned long events_discarded; /*
* Events lost in this subbuffer since
* the beginning of the trace.
struct lttng_ust_lib_ring_buffer_ctx *ctx)
{
struct lttng_channel *lttng_chan = channel_get_private(chan);
- struct lttng_event *event = ctx->priv;
+ struct lttng_stack_ctx *lttng_ctx = ctx->priv2;
size_t orig_offset = offset;
size_t padding;
padding = 0;
WARN_ON_ONCE(1);
}
- offset += ctx_get_size(offset, event->ctx);
- offset += ctx_get_size(offset, lttng_chan->ctx);
+ offset += ctx_get_size(offset, lttng_ctx->chan_ctx);
+ offset += ctx_get_size(offset, lttng_ctx->event_ctx);
*pre_header_padding = padding;
return offset - orig_offset;
subbuf_idx * chan->backend.subbuf_size,
handle);
struct lttng_channel *lttng_chan = channel_get_private(chan);
+ uint64_t cnt = shmp_index(handle, buf->backend.buf_cnt, subbuf_idx)->seq_cnt;
assert(header);
if (!header)
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 */
header->ctx.packet_size = ~0ULL;
+ header->ctx.packet_seq_num = chan->backend.num_subbuf * cnt + subbuf_idx;
header->ctx.events_discarded = 0;
header->ctx.cpu_id = buf->backend.cpu;
}
return 0;
}
+static int client_sequence_number(struct lttng_ust_lib_ring_buffer *buf,
+ struct lttng_ust_shm_handle *handle,
+ uint64_t *seq)
+{
+ struct packet_header *header;
+
+ header = client_packet_header(buf, handle);
+ *seq = header->ctx.packet_seq_num;
+ return 0;
+}
+
+static int client_instance_id(struct lttng_ust_lib_ring_buffer *buf,
+ struct lttng_ust_shm_handle *handle,
+ uint64_t *id)
+{
+ struct packet_header *header;
+
+ header = client_packet_header(buf, handle);
+ *id = header->stream_instance_id;
+ return 0;
+}
+
static const
struct lttng_ust_client_lib_ring_buffer_client_cb client_cb = {
.parent = {
.packet_size = client_packet_size,
.stream_id = client_stream_id,
.current_timestamp = client_current_timestamp,
+ .sequence_number = client_sequence_number,
+ .instance_id = client_instance_id,
};
static const struct lttng_ust_lib_ring_buffer_config client_config = {