X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Flttng-live%2Flttng-live.c;h=11b80f474d3c78c5986d21ab3c9cc89824bc7ccb;hp=0944230759937cf16f7e46d420e07a57ec2bb2b8;hb=9b4f9b425f2efce9a6ccc25f7ae062ebc1116a7d;hpb=d24d56638469189904fb6ddbb3c725817b3e9417 diff --git a/src/plugins/ctf/lttng-live/lttng-live.c b/src/plugins/ctf/lttng-live/lttng-live.c index 09442307..11b80f47 100644 --- a/src/plugins/ctf/lttng-live/lttng-live.c +++ b/src/plugins/ctf/lttng-live/lttng-live.c @@ -109,18 +109,17 @@ const char *print_state(struct lttng_live_stream_iterator *s) } while (0); BT_HIDDEN -bool lttng_live_graph_is_canceled(struct lttng_live_component *lttng_live) +bool lttng_live_graph_is_canceled(struct lttng_live_msg_iter *msg_iter) { - const bt_component *component; bool ret; - if (!lttng_live) { + if (!msg_iter) { ret = false; goto end; } - component = bt_self_component_as_component(lttng_live->self_comp); - ret = bt_component_graph_is_canceled(component); + ret = bt_self_message_iterator_is_interrupted( + msg_iter->self_msg_iter); end: return ret; @@ -259,7 +258,6 @@ end: static void lttng_live_destroy_session(struct lttng_live_session *session) { - struct lttng_live_component *live_comp; bt_logging_level log_level; bt_self_component *self_comp; @@ -272,9 +270,9 @@ void lttng_live_destroy_session(struct lttng_live_session *session) BT_COMP_LOGD("Destroy lttng live session"); if (session->id != -1ULL) { if (lttng_live_detach_session(session)) { - live_comp = session->lttng_live_msg_iter->lttng_live_comp; if (session->lttng_live_msg_iter && - !lttng_live_graph_is_canceled(live_comp)) { + !lttng_live_graph_is_canceled( + session->lttng_live_msg_iter)) { /* Old relayd cannot detach sessions. */ BT_COMP_LOGD("Unable to detach lttng live session %" PRIu64, session->id); @@ -442,7 +440,7 @@ enum lttng_live_iterator_status lttng_live_get_session( ret = lttng_live_attach_session(session); if (ret) { if (lttng_live_msg_iter && lttng_live_graph_is_canceled( - lttng_live_msg_iter->lttng_live_comp)) { + lttng_live_msg_iter)) { status = LTTNG_LIVE_ITERATOR_STATUS_AGAIN; } else { status = LTTNG_LIVE_ITERATOR_STATUS_ERROR; @@ -633,7 +631,6 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter, const bt_clock_class *clock_class = NULL; const bt_clock_snapshot *clock_snapshot = NULL; int ret = 0; - bt_message_stream_activity_clock_snapshot_state sa_cs_state; bt_logging_level log_level = lttng_live_msg_iter->log_level; bt_self_component *self_comp = lttng_live_msg_iter->self_comp; @@ -690,32 +687,6 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter, clock_snapshot = bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const( msg); break; - case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING: - clock_class = - bt_message_stream_activity_beginning_borrow_stream_class_default_clock_class_const( - msg); - BT_ASSERT(clock_class); - - sa_cs_state = bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const( - msg, &clock_snapshot); - if (sa_cs_state != BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN) { - goto no_clock_snapshot; - } - - break; - case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END: - clock_class = - bt_message_stream_activity_end_borrow_stream_class_default_clock_class_const( - msg); - BT_ASSERT(clock_class); - - sa_cs_state = bt_message_stream_activity_end_borrow_default_clock_snapshot_const( - msg, &clock_snapshot); - if (sa_cs_state != BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN) { - goto no_clock_snapshot; - } - - break; case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY: clock_snapshot = bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const( @@ -740,12 +711,6 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter, goto end; -no_clock_snapshot: - BT_COMP_LOGD_STR("Message's default clock snapshot is missing: " - "using the last message timestamp."); - *ts_ns = last_msg_ts_ns; - goto end; - error: ret = -1; @@ -901,7 +866,7 @@ retry: live_status = lttng_live_iterator_next_handle_one_quiescent_stream( lttng_live_msg_iter, stream_iter, curr_msg); if (live_status != LTTNG_LIVE_ITERATOR_STATUS_OK) { - BT_ASSERT(*curr_msg == NULL); + BT_ASSERT(!*curr_msg); goto end; } if (*curr_msg) { @@ -910,7 +875,7 @@ retry: live_status = lttng_live_iterator_next_handle_one_active_data_stream( lttng_live_msg_iter, stream_iter, curr_msg); if (live_status != LTTNG_LIVE_ITERATOR_STATUS_OK) { - BT_ASSERT(*curr_msg == NULL); + BT_ASSERT(!*curr_msg); } end: @@ -1490,7 +1455,7 @@ bt_component_class_query_method_status lttng_live_query( status = lttng_live_query_list_sessions(params, result, log_level); } else { - BT_COMP_LOGW("Unknown query object `%s`", object); + BT_COMP_LOGI("Unknown query object `%s`", object); status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_OBJECT; goto end; } @@ -1622,11 +1587,6 @@ bt_component_class_init_method_status lttng_live_component_init( goto error; } - if (lttng_live_graph_is_canceled(lttng_live)) { - ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR; - goto error; - } - add_port_status = bt_self_component_source_add_output_port( self_comp_src, "out", NULL, NULL); switch (add_port_status) {