/*
- * Copyright 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
- * Copyright 2016 - Philippe Proulx <pproulx@efficios.com>
- * Copyright 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
- * Copyright 2010-2011 - EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * SPDX-License-Identifier: MIT
*
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Copyright 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
+ * Copyright 2016 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation
*/
#define BT_COMP_LOG_SELF_COMP self_comp
uint64_t len_left;
uint64_t read_len;
+ BT_ASSERT(request_sz);
+
if (stream->has_stream_hung_up) {
status = CTF_MSG_ITER_MEDIUM_STATUS_EOF;
goto end;
len_left = stream->base_offset + stream->len - stream->offset;
if (!len_left) {
- stream->state = LTTNG_LIVE_STREAM_ACTIVE_NO_DATA;
+ lttng_live_stream_iterator_set_state(stream,
+ LTTNG_LIVE_STREAM_ACTIVE_NO_DATA);
status = CTF_MSG_ITER_MEDIUM_STATUS_AGAIN;
goto end;
}
return LTTNG_LIVE_ITERATOR_STATUS_OK;
}
+ BT_COMP_LOGD("Lazily initializing self message iterator for live session: "
+ "session-id=%"PRIu64", self-msg-iter-addr=%p", session->id,
+ self_msg_iter);
+
for (trace_idx = 0; trace_idx < session->traces->len; trace_idx++) {
struct lttng_live_trace *trace =
g_ptr_array_index(session->traces, trace_idx);
}
ctf_tc = ctf_metadata_decoder_borrow_ctf_trace_class(
trace->metadata->decoder);
+ BT_COMP_LOGD("Creating CTF message iterator: "
+ "session-id=%"PRIu64", ctf-tc-addr=%p, "
+ "stream-iter-name=%s, self-msg-iter-addr=%p",
+ session->id, ctf_tc, stream_iter->name->str, self_msg_iter);
stream_iter->msg_iter = ctf_msg_iter_create(ctf_tc,
lttng_live->max_query_size, medops, stream_iter,
log_level, self_comp, self_msg_iter);
"Failed to create CTF message iterator");
goto error;
}
-
- ctf_msg_iter_set_emit_stream_end_message(
- stream_iter->msg_iter, true);
- ctf_msg_iter_set_emit_stream_beginning_message(
- stream_iter->msg_iter, true);
}
}
stream_iter->log_level = log_level;
stream_iter->self_comp = self_comp;
- trace = lttng_live_borrow_trace(session, ctf_trace_id);
+ trace = lttng_live_session_borrow_or_create_trace_by_id(session, ctf_trace_id);
if (!trace) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Failed to borrow CTF trace.");
stream_iter->state = LTTNG_LIVE_STREAM_ACTIVE_NO_DATA;
stream_iter->viewer_stream_id = stream_id;
stream_iter->ctf_stream_class_id = -1ULL;
- stream_iter->last_inactivity_ts = INT64_MIN;
+ stream_iter->last_inactivity_ts.is_set = false;
+ stream_iter->last_inactivity_ts.value = 0;
if (trace->trace) {
struct ctf_trace_class *ctf_tc =
"Failed to create CTF message iterator");
goto error;
}
-
- ctf_msg_iter_set_emit_stream_end_message(
- stream_iter->msg_iter, true);
- ctf_msg_iter_set_emit_stream_beginning_message(
- stream_iter->msg_iter, true);
}
stream_iter->buf = g_new0(uint8_t, lttng_live->max_query_size);
if (!stream_iter->buf) {
/* Track the number of active stream iterator. */
stream_iter->trace->session->lttng_live_msg_iter->active_stream_iter--;
- /*
- * Ensure we poke the trace metadata in the future, which is
- * required to release the metadata reference on the trace.
- */
- stream_iter->trace->new_metadata_needed = true;
g_free(stream_iter);
}