#include <babeltrace/graph/message-internal.h>
#include <babeltrace/graph/message-event-const.h>
#include <babeltrace/graph/message-event-internal.h>
-#include <babeltrace/graph/message-packet-const.h>
+#include <babeltrace/graph/message-packet-beginning-const.h>
+#include <babeltrace/graph/message-packet-end-const.h>
#include <babeltrace/graph/message-packet-internal.h>
-#include <babeltrace/graph/message-stream-const.h>
+#include <babeltrace/graph/message-stream-beginning-const.h>
+#include <babeltrace/graph/message-stream-end-const.h>
#include <babeltrace/graph/message-stream-internal.h>
#include <babeltrace/graph/message-inactivity-internal.h>
+#include <babeltrace/graph/message-discarded-items-internal.h>
+#include <babeltrace/graph/message-stream-activity-internal.h>
#include <babeltrace/graph/port-const.h>
#include <babeltrace/graph/graph.h>
#include <babeltrace/graph/graph-const.h>
BT_ASSERT(upstream_port);
upstream_comp = bt_port_borrow_component_inline(upstream_port);
BT_ASSERT(upstream_comp);
+ BT_ASSERT_PRE(
+ bt_component_borrow_graph(upstream_comp)->config_state !=
+ BT_GRAPH_CONFIGURATION_STATE_CONFIGURING,
+ "Graph is not configured: %!+g",
+ bt_component_borrow_graph(upstream_comp));
upstream_comp_cls = upstream_comp->class;
BT_ASSERT(upstream_comp->class->type ==
BT_COMPONENT_CLASS_TYPE_SOURCE ||
"message iterator is in the wrong state: %!+i", iterator);
BT_ASSERT(iterator->upstream_component);
BT_ASSERT(iterator->upstream_component->class);
- BT_ASSERT_PRE(bt_component_borrow_graph(iterator->upstream_component)->is_configured,
+ BT_ASSERT_PRE(
+ bt_component_borrow_graph(iterator->upstream_component)->config_state !=
+ BT_GRAPH_CONFIGURATION_STATE_CONFIGURING,
"Graph is not configured: %!+g",
bt_component_borrow_graph(iterator->upstream_component));
BT_LIB_LOGD("Getting next self component input port "
BT_ASSERT_PRE_NON_NULL(count_to_user, "Message count (output)");
BT_LIB_LOGD("Getting next output port message iterator's messages: "
"%!+i", iterator);
-
- /*
- * As soon as the user calls this function, we mark the graph as
- * being definitely configured.
- */
- bt_graph_set_is_configured(iterator->graph, true);
-
graph_status = bt_graph_consume_sink_no_check(iterator->graph,
iterator->colander);
switch (graph_status) {
* member.
*/
bt_graph_set_can_consume(iterator->graph, false);
+
+ /*
+ * Also set the graph as being configured: it has no active sink
+ * anyway, so we don't need to call bt_graph_configure().
+ */
+ graph->config_state = BT_GRAPH_CONFIGURATION_STATE_CONFIGURED;
goto end;
error:
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator);
- BT_ASSERT_PRE(bt_component_borrow_graph(iterator->upstream_component)->is_configured,
+ BT_ASSERT_PRE(
+ bt_component_borrow_graph(iterator->upstream_component)->config_state !=
+ BT_GRAPH_CONFIGURATION_STATE_CONFIGURING,
"Graph is not configured: %!+g",
bt_component_borrow_graph(iterator->upstream_component));
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator);
- BT_ASSERT_PRE(bt_component_borrow_graph(iterator->upstream_component)->is_configured,
+ BT_ASSERT_PRE(
+ bt_component_borrow_graph(iterator->upstream_component)->config_state !=
+ BT_GRAPH_CONFIGURATION_STATE_CONFIGURING,
"Graph is not configured: %!+g",
bt_component_borrow_graph(iterator->upstream_component));
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator);
- BT_ASSERT_PRE(bt_component_borrow_graph(iterator->upstream_component)->is_configured,
+ BT_ASSERT_PRE(
+ bt_component_borrow_graph(iterator->upstream_component)->config_state !=
+ BT_GRAPH_CONFIGURATION_STATE_CONFIGURING,
"Graph is not configured: %!+g",
bt_component_borrow_graph(iterator->upstream_component));
BT_ASSERT_PRE(
const struct bt_message_event *event_msg =
(const void *) msg;
- clk_snapshot = event_msg->event->default_cs;
+ clk_snapshot = event_msg->default_cs;
BT_ASSERT_PRE(clk_snapshot,
- "Event has no default clock snapshot: %!+e",
- event_msg->event);
+ "Event message has no default clock snapshot: %!+n",
+ event_msg);
break;
}
case BT_MESSAGE_TYPE_INACTIVITY:
const struct bt_message_inactivity *inactivity_msg =
(const void *) msg;
- BT_ASSERT(inactivity_msg->default_cs);
clk_snapshot = inactivity_msg->default_cs;
+ BT_ASSERT(clk_snapshot);
break;
}
- case BT_MESSAGE_TYPE_STREAM_BEGINNING:
- case BT_MESSAGE_TYPE_STREAM_END:
- /* Ignore */
- goto end;
case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+ case BT_MESSAGE_TYPE_PACKET_END:
{
- const struct bt_message_packet_beginning *pkt_msg =
+ const struct bt_message_packet *packet_msg =
(const void *) msg;
- clk_snapshot = pkt_msg->packet->default_beginning_cs;
+ clk_snapshot = packet_msg->default_cs;
+ BT_ASSERT_PRE(clk_snapshot,
+ "Packet message has no default clock snapshot: %!+n",
+ packet_msg);
break;
}
- case BT_MESSAGE_TYPE_PACKET_END:
+ case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
+ case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
{
- const struct bt_message_packet_end *pkt_msg =
+ const struct bt_message_discarded_items *disc_items_msg =
(const void *) msg;
- clk_snapshot = pkt_msg->packet->default_end_cs;
+ clk_snapshot = disc_items_msg->default_begin_cs;
+ BT_ASSERT_PRE(clk_snapshot,
+ "Discarded events/packets message has no default clock snapshot: %!+n",
+ msg);
break;
}
+ case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
+ {
+ const struct bt_message_stream_activity *stream_act_msg =
+ (const void *) msg;
+
+ switch (stream_act_msg->default_cs_state) {
+ case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN:
+ case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE:
+ /*
+ * -inf is always less than any requested time,
+ * and we can't assume any specific time for an
+ * unknown clock snapshot, so skip this.
+ */
+ goto set_ignore;
+ case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN:
+ clk_snapshot = stream_act_msg->default_cs;
+ BT_ASSERT(clk_snapshot);
+ break;
+ default:
+ abort();
+ }
+
+ break;
+ }
+ case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END:
+ {
+ const struct bt_message_stream_activity *stream_act_msg =
+ (const void *) msg;
+
+ switch (stream_act_msg->default_cs_state) {
+ case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN:
+ /*
+ * We can't assume any specific time for an
+ * unknown clock snapshot, so skip this.
+ */
+ goto set_ignore;
+ case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE:
+ /*
+ * +inf is always greater than any requested
+ * time.
+ */
+ *ns_from_origin = INT64_MAX;
+ goto end;
+ case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN:
+ clk_snapshot = stream_act_msg->default_cs;
+ BT_ASSERT(clk_snapshot);
+ break;
+ default:
+ abort();
+ }
+
+ break;
+ }
+ case BT_MESSAGE_TYPE_STREAM_BEGINNING:
+ case BT_MESSAGE_TYPE_STREAM_END:
+ /* Ignore */
+ break;
default:
abort();
}
+set_ignore:
if (!clk_snapshot) {
*ignore = true;
goto end;
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator);
- BT_ASSERT_PRE(bt_component_borrow_graph(iterator->upstream_component)->is_configured,
+ BT_ASSERT_PRE(
+ bt_component_borrow_graph(iterator->upstream_component)->config_state !=
+ BT_GRAPH_CONFIGURATION_STATE_CONFIGURING,
"Graph is not configured: %!+g",
bt_component_borrow_graph(iterator->upstream_component));
BT_ASSERT_PRE(