Add ustctl_snapshot_sample_positions ustctl command
[lttng-ust.git] / liblttng-ust-ctl / ustctl.c
index 7b41b992fc03dc511554bb52e5fc350ac435e8cf..8e2e8f1b8b4eabf7e617a585198d5dc296db2ee1 100644 (file)
@@ -1501,6 +1501,25 @@ int ustctl_snapshot(struct ustctl_consumer_stream *stream)
                        &buf->prod_snapshot, consumer_chan->chan->handle);
 }
 
+/*
+ * Get a snapshot of the current ring buffer producer and consumer positions
+ * even if the consumed and produced positions are contained within the same
+ * subbuffer.
+ */
+int ustctl_snapshot_sample_positions(struct ustctl_consumer_stream *stream)
+{
+       struct lttng_ust_lib_ring_buffer *buf;
+       struct ustctl_consumer_channel *consumer_chan;
+
+       if (!stream)
+               return -EINVAL;
+       buf = stream->buf;
+       consumer_chan = stream->chan;
+       return lib_ring_buffer_snapshot_sample_positions(buf,
+                       &buf->cons_snapshot, &buf->prod_snapshot,
+                       consumer_chan->chan->handle);
+}
+
 /* Get the consumer position (iteration start) */
 int ustctl_snapshot_get_consumed(struct ustctl_consumer_stream *stream,
                unsigned long *pos)
This page took 0.022896 seconds and 4 git commands to generate.