Export the stream instance ID
authorJulien Desfossez <jdesfossez@efficios.com>
Tue, 7 Jul 2015 17:08:16 +0000 (13:08 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 4 Mar 2016 00:52:22 +0000 (19:52 -0500)
Allow the lttng-consumer to query the stream instance ID.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-ctl.h
liblttng-ust-ctl/ustctl.c
liblttng-ust/lttng-rb-clients.h
liblttng-ust/lttng-ring-buffer-client.h

index f62c50225c76f0a1dc0aa5713a4bef86edfaa35c..379ad41f5253f205d0e7d3917176abe4fa4f6358 100644 (file)
@@ -254,6 +254,8 @@ int ustctl_get_current_timestamp(struct ustctl_consumer_stream *stream,
                uint64_t *ts);
 int ustctl_get_sequence_number(struct ustctl_consumer_stream *stream,
                uint64_t *seq);
+int ustctl_get_instance_id(struct ustctl_consumer_stream *stream,
+               uint64_t *id);
 
 /* returns whether UST has perf counters support. */
 int ustctl_has_perf_counters(void);
index fcb6f0d55c398f2cc534d7f8aa27c5f4e21b5657..0165786c256b18203f49e9951132ead745ad638e 100644 (file)
@@ -1725,6 +1725,23 @@ int ustctl_get_sequence_number(struct ustctl_consumer_stream *stream,
        return client_cb->sequence_number(buf, handle, seq);
 }
 
+int ustctl_get_instance_id(struct ustctl_consumer_stream *stream,
+               uint64_t *id)
+{
+       struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+       struct lttng_ust_lib_ring_buffer *buf;
+       struct lttng_ust_shm_handle *handle;
+
+       if (!stream || !id)
+               return -EINVAL;
+       buf = stream->buf;
+       handle = stream->chan->chan->handle;
+       client_cb = get_client_cb(buf, handle);
+       if (!client_cb)
+               return -ENOSYS;
+       return client_cb->instance_id(buf, handle, id);
+}
+
 #if defined(__x86_64__) || defined(__i386__)
 
 int ustctl_has_perf_counters(void)
index 788f07547137799c5d8ba30fa2d63d21d6ef80a2..e54decbe68b1779e6de53590ac42d27a78985e3a 100644 (file)
@@ -45,6 +45,8 @@ struct lttng_ust_client_lib_ring_buffer_client_cb {
                        uint64_t *ts);
        int (*sequence_number) (struct lttng_ust_lib_ring_buffer *buf,
                struct lttng_ust_shm_handle *handle, uint64_t *seq);
+       int (*instance_id) (struct lttng_ust_lib_ring_buffer *buf,
+                       struct lttng_ust_shm_handle *handle, uint64_t *id);
 };
 
 #endif /* _LTTNG_RB_CLIENT_H */
index 07dc4700afdd842066a03ccd41c460db1f7f949a..9e22b93e2cc30c766ce7e2de2d9932d9ede07de6 100644 (file)
@@ -520,6 +520,17 @@ static int client_sequence_number(struct lttng_ust_lib_ring_buffer *buf,
        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 = {
@@ -541,6 +552,7 @@ struct lttng_ust_client_lib_ring_buffer_client_cb client_cb = {
        .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 = {
This page took 0.029318 seconds and 4 git commands to generate.