X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=lib%2Fgraph%2Fmessage%2Fdiscarded-items.c;fp=lib%2Fgraph%2Fmessage%2Fdiscarded-items.c;h=a6924aae3bdb9bd1c7ad129f05eeaaaad1fa3ef7;hp=82f0039244c2bacb89e0da28b6fc8c9db5ace4a5;hb=2e90378a2b94006e2743b06e7fe7a1f0e691a56e;hpb=7fe92073394104c8ffe575b1b05ee4fe1df356ea diff --git a/lib/graph/message/discarded-items.c b/lib/graph/message/discarded-items.c index 82f00392..a6924aae 100644 --- a/lib/graph/message/discarded-items.c +++ b/lib/graph/message/discarded-items.c @@ -69,16 +69,32 @@ struct bt_message *create_discarded_items_message( { struct bt_message_discarded_items *message; struct bt_stream_class *stream_class; + bool has_support; + bool has_default_clock_snapshots; BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator"); BT_ASSERT_PRE_NON_NULL(stream, "Stream"); stream_class = bt_stream_borrow_class(stream); BT_ASSERT(stream_class); - BT_ASSERT_PRE((with_cs && stream_class->default_clock_class) || - (!with_cs && !stream_class->default_clock_class), - "Creating a message with a default clock snapshot, but without " - "a default clock class, or without a default clock snapshot, " - "but with a default clock class: ", + + if (type == BT_MESSAGE_TYPE_DISCARDED_EVENTS) { + has_support = stream_class->supports_discarded_events; + has_default_clock_snapshots = + stream_class->discarded_events_have_default_clock_snapshots; + } else { + has_support = stream_class->supports_discarded_packets; + has_default_clock_snapshots = + stream_class->discarded_packets_have_default_clock_snapshots; + } + + BT_ASSERT_PRE(has_support, + "Stream class does not support discarded events or packets: " + "type=%s, %![stream-]+s, %![sc-]+S", + bt_message_type_string(type), stream, stream_class); + BT_ASSERT_PRE((with_cs && has_default_clock_snapshots) || + (!with_cs && !has_default_clock_snapshots), + "Unexpected stream class configuration when creating " + "a discarded events or packets message: " "type=%s, %![stream-]+s, %![sc-]+S, with-cs=%d, " "cs-begin-val=%" PRIu64 ", cs-end-val=%" PRIu64, bt_message_type_string(type), stream, stream_class,