LTTNG_ASSERT(channel);
LTTNG_ASSERT(ctx);
- stream = consumer_stream_create(
- channel,
- channel->key,
- key,
- channel->name,
- channel->relayd_id,
- channel->session_id,
- channel->trace_chunk,
- cpu,
- &alloc_ret,
- channel->type,
- channel->monitor);
+ stream = consumer_stream_create(channel, channel->key, key, channel->name,
+ channel->relayd_id, channel->session_id, channel->trace_chunk, cpu,
+ &alloc_ret, channel->type, channel->monitor, channel->trace_format);
if (stream == NULL) {
switch (alloc_ret) {
case -ENOENT:
next:
pthread_mutex_unlock(&stream->lock);
}
+
+ /*
+ * Send one last buffer statistics update to the session daemon. This
+ * ensures that the session daemon gets at least one statistics update
+ * per channel even in the case of short-lived channels, such as when a
+ * short-lived app is traced in per-pid mode.
+ */
+ sample_and_send_channel_buffer_stats(channel);
error:
rcu_read_unlock();
return ret;
};
/* Create a plain object and reserve a channel key. */
- channel = consumer_allocate_channel(
- msg.u.ask_channel.key,
+ channel = consumer_allocate_channel(msg.u.ask_channel.key,
msg.u.ask_channel.session_id,
- msg.u.ask_channel.chunk_id.is_set ?
- &chunk_id : NULL,
- msg.u.ask_channel.pathname,
- msg.u.ask_channel.name,
+ msg.u.ask_channel.chunk_id.is_set ? &chunk_id : NULL,
+ msg.u.ask_channel.pathname, msg.u.ask_channel.name,
msg.u.ask_channel.relayd_id,
(enum lttng_event_output) msg.u.ask_channel.output,
- msg.u.ask_channel.tracefile_size,
- msg.u.ask_channel.tracefile_count,
- msg.u.ask_channel.session_id_per_pid,
- msg.u.ask_channel.monitor,
- msg.u.ask_channel.live_timer_interval,
- msg.u.ask_channel.is_live,
- msg.u.ask_channel.root_shm_path,
- msg.u.ask_channel.shm_path);
+ msg.u.ask_channel.tracefile_size, msg.u.ask_channel.tracefile_count,
+ msg.u.ask_channel.session_id_per_pid, msg.u.ask_channel.monitor,
+ msg.u.ask_channel.live_timer_interval, msg.u.ask_channel.is_live,
+ msg.u.ask_channel.root_shm_path, msg.u.ask_channel.shm_path,
+ msg.u.ask_channel.trace_format);
if (!channel) {
goto end_channel_error;
}
case LTTNG_CONSUMER_INIT:
{
int ret_send_status;
+ lttng_uuid sessiond_uuid;
- ret_code = lttng_consumer_init_command(ctx,
- msg.u.init.sessiond_uuid);
+ std::copy(std::begin(msg.u.init.sessiond_uuid), std::end(msg.u.init.sessiond_uuid),
+ sessiond_uuid.begin());
+ ret_code = lttng_consumer_init_command(ctx, sessiond_uuid);
health_code_update();
ret_send_status = consumer_send_status_msg(sock, ret_code);
if (ret_send_status < 0) {
stream->quiescent = true;
}
}
- pthread_mutex_unlock(&stream->lock);
+
stream->hangup_flush_done = 1;
+ pthread_mutex_unlock(&stream->lock);
}
void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)