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>
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);
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)
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 */
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 = {
.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 = {