[lttng-dev] [MODULES PATCH 1/3] Add stream instance id to the packet header

Julien Desfossez jdesfossez at efficios.com
Mon Jul 13 11:09:23 EDT 2015


This new field allows the viewer to distinguish between trace files
belonging to the same packet stream (in LTTng: the same CPU in the same
channel).

Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
 lttng-events.c             | 1 +
 lttng-ring-buffer-client.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/lttng-events.c b/lttng-events.c
index 9769f89..3cbfcbf 100644
--- a/lttng-events.c
+++ b/lttng-events.c
@@ -1973,6 +1973,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
 		"		uint32_t magic;\n"
 		"		uint8_t  uuid[16];\n"
 		"		uint32_t stream_id;\n"
+		"		uint64_t stream_instance_id;\n"
 		"	};\n"
 		"};\n\n",
 		lttng_alignof(uint8_t) * CHAR_BIT,
diff --git a/lttng-ring-buffer-client.h b/lttng-ring-buffer-client.h
index 7055e77..72fbf18 100644
--- a/lttng-ring-buffer-client.h
+++ b/lttng-ring-buffer-client.h
@@ -57,6 +57,7 @@ struct packet_header {
 					 */
 	uint8_t uuid[16];
 	uint32_t stream_id;
+	uint64_t stream_instance_id;
 
 	struct {
 		/* Stream packet context */
@@ -351,6 +352,7 @@ static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc,
 	header->magic = CTF_MAGIC_NUMBER;
 	memcpy(header->uuid, session->uuid.b, sizeof(session->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 */
-- 
1.9.1




More information about the lttng-dev mailing list