//wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
int (*is_finalized)(struct channel *chan);
int (*is_disabled)(struct channel *chan);
+ int (*flush_buffers)(struct channel *chan, struct shm_handle *handle);
};
struct ltt_channel {
/* Event and Channel FD commands */
#define LTTNG_UST_CONTEXT \
_UST_CMDW(0x70, struct lttng_ust_context)
+#define LTTNG_UST_FLUSH_BUFFERS \
+ _UST_CMD(0x71)
/* Event, Channel and Session commands */
#define LTTNG_UST_ENABLE _UST_CMD(0x80)
int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v);
int ustctl_wait_quiescent(int sock);
+/* Flush each buffers in this channel */
+int ustctl_flush_buffers(int sock, struct object_data *channel_data);
+
/* not implemented yet */
struct lttng_ust_calibrate;
int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate);
return lib_ring_buffer_channel_is_disabled(chan);
}
+static
+int ltt_flush_buffers(struct channel *chan, struct shm_handle *handle)
+{
+ struct lib_ring_buffer *buf;
+ int cpu;
+
+ for_each_channel_cpu(cpu, chan) {
+ int shm_fd, wait_fd;
+ uint64_t memory_map_size;
+
+ buf = channel_get_ring_buffer(&client_config, chan,
+ cpu, handle, &shm_fd, &wait_fd,
+ &memory_map_size);
+ lib_ring_buffer_switch(&client_config, buf,
+ SWITCH_ACTIVE, handle);
+ }
+ return 0;
+}
+
static struct ltt_transport ltt_relay_transport = {
.name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING "-mmap",
.ops = {
//.get_hp_wait_queue = ltt_get_hp_wait_queue,
.is_finalized = ltt_is_finalized,
.is_disabled = ltt_is_disabled,
+ .flush_buffers = ltt_flush_buffers,
},
};
return lib_ring_buffer_channel_is_disabled(chan);
}
+static
+int ltt_flush_buffers(struct channel *chan, struct shm_handle *handle)
+{
+ struct lib_ring_buffer *buf;
+ int shm_fd, wait_fd;
+ uint64_t memory_map_size;
+
+ buf = channel_get_ring_buffer(&client_config, chan,
+ 0, handle, &shm_fd, &wait_fd,
+ &memory_map_size);
+ lib_ring_buffer_switch(&client_config, buf,
+ SWITCH_ACTIVE, handle);
+ return 0;
+}
+
static struct ltt_transport ltt_relay_transport = {
.name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING "-mmap",
.ops = {
//.get_hp_wait_queue = ltt_get_hp_wait_queue,
.is_finalized = ltt_is_finalized,
.is_disabled = ltt_is_disabled,
+ .flush_buffers = ltt_flush_buffers,
},
};
return ltt_channel_enable(channel);
case LTTNG_UST_DISABLE:
return ltt_channel_disable(channel);
+ case LTTNG_UST_FLUSH_BUFFERS:
+ return channel->ops->flush_buffers(channel->chan, channel->handle);
default:
return -EINVAL;
}
static
long lttng_metadata_cmd(int objd, unsigned int cmd, unsigned long arg)
{
+ struct ltt_channel *channel = objd_private(objd);
+
switch (cmd) {
case LTTNG_UST_STREAM:
{
/* stream used as output */
return lttng_abi_open_stream(objd, stream);
}
+ case LTTNG_UST_FLUSH_BUFFERS:
+ return channel->ops->flush_buffers(channel->chan, channel->handle);
default:
return -EINVAL;
}
*
* This object descriptor implements lttng commands:
* (None for now. Access is done directly though shm.)
- * TODO: Add buffer flush.
*/
static
long lttng_rb_cmd(int objd, unsigned int cmd, unsigned long arg)
{
- //struct stream_priv_data *priv = objd_private(objd);
-
switch (cmd) {
default:
return -EINVAL;
return 0;
}
+int ustctl_flush_buffers(int sock, struct object_data *channel_data)
+{
+ struct ustcomm_ust_msg lum;
+ struct ustcomm_ust_reply lur;
+
+ memset(&lum, 0, sizeof(lum));
+ lum.handle = channel_data->handle;
+ lum.cmd = LTTNG_UST_FLUSH_BUFFERS;
+ return ustcomm_send_app_cmd(sock, &lum, &lur);
+}
+
int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate)
{
return -ENOSYS;