Per-stream ioctl to get the current timestamp
authorJulien Desfossez <jdesfossez@efficios.com>
Thu, 19 Sep 2013 17:51:55 +0000 (13:51 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 19 Sep 2013 19:29:03 +0000 (14:29 -0500)
Signed-off-by: Julien Desfossez <jdesfossez@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 88112adc29c2f1d8a3ee11d48567cb6ee684055d..c8ac3f90d29d5dc60914ae9a6fca36df1485acf7 100644 (file)
@@ -233,6 +233,8 @@ int ustctl_get_packet_size(struct ustctl_consumer_stream *stream,
        uint64_t *packet_size);
 int ustctl_get_stream_id(struct ustctl_consumer_stream *stream,
                uint64_t *stream_id);
+int ustctl_get_current_timestamp(struct ustctl_consumer_stream *stream,
+               uint64_t *ts);
 
 /* event registry management */
 
index 7830132b8c41d08c295bc2dc10cee41faf3940da..11fc70446ea5ac015d0d9e613df73c1aef785ad8 100644 (file)
@@ -1571,6 +1571,21 @@ int ustctl_get_stream_id(struct ustctl_consumer_stream *stream,
        return client_cb->stream_id(buf, handle, stream_id);
 }
 
+int ustctl_get_current_timestamp(struct ustctl_consumer_stream *stream,
+               uint64_t *ts)
+{
+       struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+       struct lttng_ust_lib_ring_buffer *buf = stream->buf;
+       struct lttng_ust_shm_handle *handle = stream->chan->chan->handle;
+
+       if (!stream || !ts)
+               return -EINVAL;
+       client_cb = get_client_cb(buf, handle);
+       if (!client_cb || !client_cb->current_timestamp)
+               return -ENOSYS;
+       return client_cb->current_timestamp(buf, handle, ts);
+}
+
 /*
  * Returns 0 on success, negative error value on error.
  */
index c43aa756d40d269114aee310a8223df141cd6c65..85d4e1bcbfe1477cd85a340af3bb750367bbcd0c 100644 (file)
@@ -40,6 +40,9 @@ struct lttng_ust_client_lib_ring_buffer_client_cb {
        int (*stream_id) (struct lttng_ust_lib_ring_buffer *buf,
                        struct lttng_ust_shm_handle *handle,
                        uint64_t *stream_id);
+       int (*current_timestamp) (struct lttng_ust_lib_ring_buffer *buf,
+                       struct lttng_ust_shm_handle *handle,
+                       uint64_t *ts);
 };
 
 #endif /* _LTTNG_RB_CLIENT_H */
index 46717135cd4cdf9536f3ff74a4cd4252a8c7e849..2cdecbe9f6bfdd8cf670304b20b29cc06cdaa4f1 100644 (file)
@@ -470,6 +470,18 @@ static int client_stream_id(struct lttng_ust_lib_ring_buffer *buf,
        return 0;
 }
 
+static int client_current_timestamp(struct lttng_ust_lib_ring_buffer *buf,
+               struct lttng_ust_shm_handle *handle,
+               uint64_t *ts)
+{
+       struct channel *chan;
+
+       chan = shmp(handle, handle->chan);
+       *ts = client_ring_buffer_clock_read(chan);
+
+       return 0;
+}
+
 static const
 struct lttng_ust_client_lib_ring_buffer_client_cb client_cb = {
        .parent = {
@@ -487,6 +499,7 @@ struct lttng_ust_client_lib_ring_buffer_client_cb client_cb = {
        .content_size = client_content_size,
        .packet_size = client_packet_size,
        .stream_id = client_stream_id,
+       .current_timestamp = client_current_timestamp,
 };
 
 static const struct lttng_ust_lib_ring_buffer_config client_config = {
This page took 0.028534 seconds and 4 git commands to generate.