lib: remove "unknown clock snapshot" concept
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 31 May 2019 12:33:14 +0000 (08:33 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 31 May 2019 14:48:02 +0000 (10:48 -0400)
The team decided that, because this "unknown clock snapshot" feature has
no current use case and that CTF 1.8 cannot use it, we can wait until we
really need it to implement it.

The feature was only partially implemented: you could know that a given
clock snapshot is unknown, but you could not make one unknown. This
asymmetry was so that current consumers (filters and sinks) could
support unknown clock snapshots without taking the development time to
make the producers (sources and filters) create them. This is another
proof that the feature is not needed now.

In the library, all bt_*_borrow_*_clock_snapshot() functions, except for
bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const()
and
bt_message_stream_activity_end_borrow_default_clock_snapshot_const(),
now return the borrowed clock snapshot object instead of returning a
clock snapshot status (known or unknown). Python bindings and plugins
are adapted accordingly.

The `BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN` state
still exists for stream activity messages because it can be useful to
set that the first stream activity beginning or the last stream activity
end is unknown. `src.ctf.fs` is one user of this state.

Also, the bt_stream_class_default_clock_is_always_known() function is
removed because the default clock is always known. This function
unconditionally returned `BT_TRUE` anyway. Python bindings and plugins
are adapted accordingly.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2665f713917b14efdecb181bef16c199ddd9eb81
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1358
Tested-by: jenkins
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
26 files changed:
bindings/python/bt2/bt2/native_bt_clock_snapshot.i
bindings/python/bt2/bt2/native_bt_message.i
bindings/python/bt2/bt2/native_bt_stream_class.i
include/babeltrace/graph/message-discarded-events-const.h
include/babeltrace/graph/message-discarded-packets-const.h
include/babeltrace/graph/message-event-const.h
include/babeltrace/graph/message-message-iterator-inactivity-const.h
include/babeltrace/graph/message-packet-beginning-const.h
include/babeltrace/graph/message-packet-end-const.h
include/babeltrace/graph/message-stream-beginning-const.h
include/babeltrace/graph/message-stream-end-const.h
include/babeltrace/trace-ir/clock-snapshot-const.h
include/babeltrace/trace-ir/stream-class-const.h
lib/graph/message/discarded-items.c
lib/graph/message/event.c
lib/graph/message/message-iterator-inactivity.c
lib/graph/message/packet.c
lib/trace-ir/stream-class.c
plugins/ctf/fs-sink/fs-sink.c
plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.c
plugins/ctf/lttng-live/lttng-live.c
plugins/lttng-utils/debug-info/debug-info.c
plugins/lttng-utils/debug-info/trace-ir-mapping.c
plugins/text/pretty/print.c
plugins/utils/muxer/muxer.c
plugins/utils/trimmer/trimmer.c

index 44748ccacbe4c3929d818aa6fccbb61fc50c9570..a2ca8e866e086b0acc1bd2cc45282770d08020cd 100644 (file)
 
 /* From clock-snapshot-const.h */
 
-typedef enum bt_clock_snapshot_state {
-       BT_CLOCK_SNAPSHOT_STATE_KNOWN,
-       BT_CLOCK_SNAPSHOT_STATE_UNKNOWN,
-} bt_clock_snapshot_state;
-
 typedef enum bt_clock_snapshot_status {
        BT_CLOCK_SNAPSHOT_STATUS_OK = 0,
        BT_CLOCK_SNAPSHOT_STATUS_OVERFLOW = -75,
index 07c76786713a7f0a4350cacc471322bafa414997..c4f1937f71099fdd04f5b3b857dd748bd825a872 100644 (file)
  * THE SOFTWARE.
  */
 
-
-/* Output argument typemap for clock value output (always appends) */
-%typemap(in, numinputs=0)
-       (const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT)
-       (bt_clock_snapshot *temp_clock_snapshot = NULL) {
-       $1 = &temp_clock_snapshot;
-}
-
-%typemap(argout)
-       (const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT) {
-       if (*$1) {
-               /* SWIG_Python_AppendOutput() steals the created object */
-               $result = SWIG_Python_AppendOutput($result,
-                               SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
-                                       SWIGTYPE_p_bt_clock_snapshot, 0));
-       } else {
-               /* SWIG_Python_AppendOutput() steals Py_None */
-               Py_INCREF(Py_None);
-               $result = SWIG_Python_AppendOutput($result, Py_None);
-       }
-}
-
 /* From message-const.h */
 
 typedef enum bt_message_type {
@@ -70,9 +48,9 @@ extern void bt_message_put_ref(const bt_message *message);
 extern const bt_event *bt_message_event_borrow_event_const(
                const bt_message *message);
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_event_borrow_default_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+               const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_event_borrow_stream_class_default_clock_class_const(
@@ -97,9 +75,9 @@ extern bt_event *bt_message_event_borrow_event(
 
 /* From message-message-iterator-inactivity-const.h */
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+               const bt_message *msg);
 
 /* From message-message-iterator-inactivity.h */
 
@@ -143,9 +121,9 @@ extern bt_stream *bt_message_stream_end_borrow_stream(
 extern const bt_packet *bt_message_packet_beginning_borrow_packet_const(
                const bt_message *message);
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_packet_beginning_borrow_default_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+               const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_packet_beginning_borrow_stream_class_default_clock_class_const(
@@ -171,9 +149,9 @@ extern bt_packet *bt_message_packet_beginning_borrow_packet(
 extern const bt_packet *bt_message_packet_end_borrow_packet_const(
                const bt_message *message);
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_packet_end_borrow_default_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+               const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_packet_end_borrow_stream_class_default_clock_class_const(
@@ -264,13 +242,13 @@ extern bt_stream *bt_message_stream_activity_end_borrow_stream(
 
 /* From message-discarded-events-const.h */
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+               const bt_message *msg);
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+               const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_discarded_events_borrow_stream_class_default_clock_class_const(
@@ -301,13 +279,13 @@ extern void bt_message_discarded_events_set_count(bt_message *message,
 
 /* From message-discarded-packets-const.h */
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+               const bt_message *msg);
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **BTOUTCLOCKSNAPSHOT);
+               const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_discarded_packets_borrow_stream_class_default_clock_class_const(
index 94c2b5062c017280ec059cf8d7f7a6f3092bd2c7..b7c22c0cb329fe5821dbc2fd919bea209f1436c9 100644 (file)
@@ -67,9 +67,6 @@ extern const bt_clock_class *
 bt_stream_class_borrow_default_clock_class_const(
                const bt_stream_class *stream_class);
 
-extern bt_bool bt_stream_class_default_clock_is_always_known(
-               const bt_stream_class *stream_class);
-
 extern void bt_stream_class_get_ref(const bt_stream_class *stream_class);
 
 extern void bt_stream_class_put_ref(const bt_stream_class *stream_class);
index 68615526f254d30dded6d2c4901887d42737cd4a..0ac574391de7cf8fc4a74fa92b54d99b3a0262fd 100644 (file)
 /* For bt_message, bt_clock_snapshot, bt_stream */
 #include <babeltrace/types.h>
 
-/* For bt_clock_snapshot_state */
-#include <babeltrace/trace-ir/clock-snapshot-const.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **snapshot);
+               const bt_message *msg);
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **snapshot);
+               const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_discarded_events_borrow_stream_class_default_clock_class_const(
index 77d5d413dfcf2686e4bdf56b2b2f2285bb8c9c12..4c80b52814694547c8c59c2b58cbda5dea749c56 100644 (file)
 /* For bt_message, bt_clock_snapshot, bt_stream */
 #include <babeltrace/types.h>
 
-/* For bt_clock_snapshot_state */
-#include <babeltrace/trace-ir/clock-snapshot-const.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **snapshot);
+               const bt_message *msg);
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **snapshot);
+               const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_discarded_packets_borrow_stream_class_default_clock_class_const(
index 4c611925874a31255bff826696d4ab17ddfcf35c..52044d08056619bc70b381e6b165452be8b05074 100644 (file)
@@ -27,9 +27,6 @@
 /* For bt_bool, bt_message, bt_event. bt_clock_class, bt_clock_snapshot */
 #include <babeltrace/types.h>
 
-/* For bt_clock_snapshot_state */
-#include <babeltrace/trace-ir/clock-snapshot-const.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -37,9 +34,8 @@ extern "C" {
 extern const bt_event *bt_message_event_borrow_event_const(
                const bt_message *message);
 
-extern bt_clock_snapshot_state
-bt_message_event_borrow_default_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **snapshot);
+extern const bt_clock_snapshot *
+bt_message_event_borrow_default_clock_snapshot_const(const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_event_borrow_stream_class_default_clock_class_const(
index 02f5b0084b653744cce4f670426ebcdb4ae5cc28..9be2c8600f1bc2aa24c5710665a0e4fb0de3a3b4 100644 (file)
 /* For bt_message, bt_clock_snapshot */
 #include <babeltrace/types.h>
 
-/* For bt_clock_snapshot_state */
-#include <babeltrace/trace-ir/clock-snapshot-const.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **snapshot);
+               const bt_message *msg);
 
 #ifdef __cplusplus
 }
index a7cc1348a5cadd56f18c0d7079c04be67a775823..85e3294eef7114550ccc0dc43c2ed1698d8be090 100644 (file)
@@ -27,9 +27,6 @@
 /* For bt_message, bt_packet, bt_clock_snapshot, bt_clock_class */
 #include <babeltrace/types.h>
 
-/* For bt_clock_snapshot_state */
-#include <babeltrace/trace-ir/clock-snapshot-const.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -37,9 +34,9 @@ extern "C" {
 extern const bt_packet *bt_message_packet_beginning_borrow_packet_const(
                const bt_message *message);
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_packet_beginning_borrow_default_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **snapshot);
+               const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_packet_beginning_borrow_stream_class_default_clock_class_const(
index 3a48911e980389a515c7d78b6378a3bcbe823fcf..81a31ebde2c7a162c1a9cc36741ad097896127fb 100644 (file)
@@ -27,9 +27,6 @@
 /* For bt_message, bt_packet, bt_clock_snapshot, bt_clock_class */
 #include <babeltrace/types.h>
 
-/* For bt_clock_snapshot_state */
-#include <babeltrace/trace-ir/clock-snapshot-const.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -37,9 +34,9 @@ extern "C" {
 extern const bt_packet *bt_message_packet_end_borrow_packet_const(
                const bt_message *message);
 
-extern bt_clock_snapshot_state
+extern const bt_clock_snapshot *
 bt_message_packet_end_borrow_default_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **snapshot);
+               const bt_message *msg);
 
 extern const bt_clock_class *
 bt_message_packet_end_borrow_stream_class_default_clock_class_const(
index 09960f77dadb77f1391df9ca507b034feafd6c22..994fb5cb071b2001d9efa899afdfaf699c0851ab 100644 (file)
@@ -27,9 +27,6 @@
 /* For bt_message, bt_clock_snapshot, bt_stream */
 #include <babeltrace/types.h>
 
-/* For bt_clock_snapshot_state */
-#include <babeltrace/trace-ir/clock-snapshot-const.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
index 1ee0a47b885e90138d3b07a03f8c24efc0dfe734..87153e0bf063ad76bca314d2c319f86d769433d8 100644 (file)
@@ -27,9 +27,6 @@
 /* For bt_message, bt_clock_snapshot, bt_stream */
 #include <babeltrace/types.h>
 
-/* For bt_clock_snapshot_state */
-#include <babeltrace/trace-ir/clock-snapshot-const.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
index 73ddb5be1adc7a9cb3d685778709751860ab0e7c..062fe6802b434c124b32d304af712a334615d0c9 100644 (file)
 extern "C" {
 #endif
 
-typedef enum bt_clock_snapshot_state {
-       BT_CLOCK_SNAPSHOT_STATE_KNOWN,
-       BT_CLOCK_SNAPSHOT_STATE_UNKNOWN,
-} bt_clock_snapshot_state;
-
 typedef enum bt_clock_snapshot_status {
        BT_CLOCK_SNAPSHOT_STATUS_OK = 0,
        BT_CLOCK_SNAPSHOT_STATUS_OVERFLOW = -75,
index ac5c6bc514b88772ad2e6e69bd6db494e8f13660..c8fe18f9f36fd46f3a2b1a2e27ee69d4dad144b5 100644 (file)
@@ -82,9 +82,6 @@ extern const bt_clock_class *
 bt_stream_class_borrow_default_clock_class_const(
                const bt_stream_class *stream_class);
 
-extern bt_bool bt_stream_class_default_clock_is_always_known(
-               const bt_stream_class *stream_class);
-
 extern void bt_stream_class_get_ref(const bt_stream_class *stream_class);
 
 extern void bt_stream_class_put_ref(const bt_stream_class *stream_class);
index cd40a3f3fa6a25a2b07922d439881949705e8e93..82f0039244c2bacb89e0da28b6fc8c9db5ace4a5 100644 (file)
@@ -166,10 +166,9 @@ enum bt_property_availability get_discarded_items_message_count(
 }
 
 static inline
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 borrow_discarded_items_message_default_beginning_clock_snapshot_const(
-               const struct bt_message *message,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *message)
 {
        struct bt_message_discarded_items *disc_items_msg = (void *) message;
 
@@ -178,16 +177,13 @@ borrow_discarded_items_message_default_beginning_clock_snapshot_const(
                "Message's stream's class has no default clock class: "
                "%![msg-]+n, %![sc-]+S",
                message, disc_items_msg->stream->class);
-       BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)");
-       *snapshot = disc_items_msg->default_begin_cs;
-       return BT_CLOCK_SNAPSHOT_STATE_KNOWN;
+       return disc_items_msg->default_begin_cs;
 }
 
 static inline
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 borrow_discarded_items_message_default_end_clock_snapshot_const(
-               const struct bt_message *message,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *message)
 {
        struct bt_message_discarded_items *disc_items_msg = (void *) message;
 
@@ -196,9 +192,7 @@ borrow_discarded_items_message_default_end_clock_snapshot_const(
                "Message's stream's class has no default clock class: "
                "%![msg-]+n, %![sc-]+S",
                message, disc_items_msg->stream->class);
-       BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)");
-       *snapshot = disc_items_msg->default_end_cs;
-       return BT_CLOCK_SNAPSHOT_STATE_KNOWN;
+       return disc_items_msg->default_end_cs;
 }
 
 struct bt_message *bt_message_discarded_events_create(
@@ -236,26 +230,24 @@ void bt_message_discarded_events_set_count(struct bt_message *message,
        set_discarded_items_message_count(message, count);
 }
 
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-               const struct bt_message *msg,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *msg)
 {
        BT_ASSERT_PRE_NON_NULL(msg, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
        return borrow_discarded_items_message_default_beginning_clock_snapshot_const(
-               msg, snapshot);
+               msg);
 }
 
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
-               const struct bt_message *msg,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *msg)
 {
        BT_ASSERT_PRE_NON_NULL(msg, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
        return borrow_discarded_items_message_default_end_clock_snapshot_const(
-               msg, snapshot);
+               msg);
 }
 
 const struct bt_stream *
@@ -308,26 +300,24 @@ void bt_message_discarded_packets_set_count(struct bt_message *message,
        set_discarded_items_message_count(message, count);
 }
 
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-               const struct bt_message *msg,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *msg)
 {
        BT_ASSERT_PRE_NON_NULL(msg, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
        return borrow_discarded_items_message_default_beginning_clock_snapshot_const(
-               msg, snapshot);
+               msg);
 }
 
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
-               const struct bt_message *msg,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *msg)
 {
        BT_ASSERT_PRE_NON_NULL(msg, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
        return borrow_discarded_items_message_default_end_clock_snapshot_const(
-               msg, snapshot);
+               msg);
 }
 
 const struct bt_stream *
index 33e423e1ed1e6da34449df8b20da3cd5e4211420..d8e2b8ce6fc0821fb6abdb14558ab0f6430a1cc8 100644 (file)
@@ -255,10 +255,9 @@ const struct bt_event *bt_message_event_borrow_event_const(
        return borrow_event((void *) message);
 }
 
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 bt_message_event_borrow_default_clock_snapshot_const(
-               const struct bt_message *msg,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *msg)
 {
        struct bt_message_event *event_msg = (void *) msg;
        struct bt_stream_class *stream_class;
@@ -271,9 +270,7 @@ bt_message_event_borrow_default_clock_snapshot_const(
        BT_ASSERT_PRE(stream_class->default_clock_class,
                "Message's stream's class has no default clock class: "
                "%![msg-]+n, %![sc-]+S", msg, stream_class);
-       BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)");
-       *snapshot = event_msg->default_cs;
-       return BT_CLOCK_SNAPSHOT_STATE_KNOWN;
+       return event_msg->default_cs;
 }
 
 const bt_clock_class *
index 26b863f482969cf9a07abaa3767ec0b013d92479..0d1a2abaeeb01b28525c139e8ba636e7aecb7282 100644 (file)
@@ -93,15 +93,13 @@ end:
        return (void *) ret_msg;
 }
 
-extern enum bt_clock_snapshot_state
+extern const struct bt_clock_snapshot *
 bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
-               const bt_message *msg, const bt_clock_snapshot **snapshot)
+               const bt_message *msg)
 {
        struct bt_message_message_iterator_inactivity *inactivity = (void *) msg;
 
        BT_ASSERT_PRE_NON_NULL(msg, "Message");
-       BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)");
        BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY);
-       *snapshot = inactivity->default_cs;
-       return BT_CLOCK_SNAPSHOT_STATE_KNOWN;
+       return inactivity->default_cs;
 }
index 87c241e0e120c373ece2c4cd14be11906da84364..ee378e583503f80142aac4d7e6aea0ed10ff6ef0 100644 (file)
@@ -285,10 +285,9 @@ const struct bt_packet *bt_message_packet_end_borrow_packet_const(
 }
 
 static inline
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 borrow_packet_message_default_clock_snapshot_const(
-               const struct bt_message *message,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *message)
 {
        struct bt_message_packet *packet_msg = (void *) message;
 
@@ -297,31 +296,25 @@ borrow_packet_message_default_clock_snapshot_const(
                "Message's stream's class has no default clock class: "
                "%![msg-]+n, %![sc-]+S",
                message, packet_msg->packet->stream->class);
-       BT_ASSERT_PRE_NON_NULL(snapshot, "Clock snapshot (output)");
-       *snapshot = packet_msg->default_cs;
-       return BT_CLOCK_SNAPSHOT_STATE_KNOWN;
+       return packet_msg->default_cs;
 }
 
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 bt_message_packet_beginning_borrow_default_clock_snapshot_const(
-               const struct bt_message *msg,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *msg)
 {
        BT_ASSERT_PRE_NON_NULL(msg, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_BEGINNING);
-       return borrow_packet_message_default_clock_snapshot_const(
-               msg, snapshot);
+       return borrow_packet_message_default_clock_snapshot_const(msg);
 }
 
-enum bt_clock_snapshot_state
+const struct bt_clock_snapshot *
 bt_message_packet_end_borrow_default_clock_snapshot_const(
-               const struct bt_message *msg,
-               const struct bt_clock_snapshot **snapshot)
+               const struct bt_message *msg)
 {
        BT_ASSERT_PRE_NON_NULL(msg, "Message");
        BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_END);
-       return borrow_packet_message_default_clock_snapshot_const(
-               msg, snapshot);
+       return borrow_packet_message_default_clock_snapshot_const(msg);
 }
 
 static inline
index 1271374260a1fc513f9546b8975512706708828e..e4f48f4eccb252d740019121e08d4bd696a82488 100644 (file)
@@ -469,13 +469,6 @@ void bt_stream_class_set_assigns_automatic_stream_id(
                "assignment property: %!+S", stream_class);
 }
 
-bt_bool bt_stream_class_default_clock_is_always_known(
-               const struct bt_stream_class *stream_class)
-{
-       /* BT_CLOCK_SNAPSHOT_STATE_UNKNOWN is not supported as of 2.0 */
-       return BT_TRUE;
-}
-
 void bt_stream_class_get_ref(const struct bt_stream_class *stream_class)
 {
        bt_object_get_ref(stream_class);
index bc8d3fa1338c8a297b46af17c17ebe5e59500345..83742ed1240eedc13173d4040291823aa561f203 100644 (file)
@@ -288,8 +288,8 @@ bt_self_component_status handle_event_msg(struct fs_sink_comp *fs_sink,
        BT_ASSERT(ec);
 
        if (stream->sc->default_clock_class) {
-               (void) bt_message_event_borrow_default_clock_snapshot_const(
-                       msg, &cs);
+               cs = bt_message_event_borrow_default_clock_snapshot_const(
+                       msg);
        }
 
        ret = fs_sink_stream_write_event(stream, cs, ir_event, ec);
@@ -321,8 +321,8 @@ bt_self_component_status handle_packet_beginning_msg(
        }
 
        if (stream->sc->default_clock_class) {
-               (void) bt_message_packet_beginning_borrow_default_clock_snapshot_const(
-                       msg, &cs);
+               cs = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
+                       msg);
                BT_ASSERT(cs);
        }
 
@@ -457,14 +457,14 @@ bt_self_component_status handle_packet_end_msg(
        }
 
        if (stream->sc->default_clock_class) {
-               (void) bt_message_packet_end_borrow_default_clock_snapshot_const(
-                       msg, &cs);
+               cs = bt_message_packet_end_borrow_default_clock_snapshot_const(
+                       msg);
                BT_ASSERT(cs);
        }
 
        if (stream->sc->default_clock_class) {
-               (void) bt_message_packet_end_borrow_default_clock_snapshot_const(
-                       msg, &cs);
+               cs = bt_message_packet_end_borrow_default_clock_snapshot_const(
+                       msg);
                BT_ASSERT(cs);
        }
 
@@ -631,14 +631,13 @@ bt_self_component_status handle_discarded_events_msg(
                 * The clock snapshot values will be validated when
                 * handling the next "packet beginning" message.
                 */
-               (void) bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-                       msg, &cs);
+               cs = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
+                       msg);
                BT_ASSERT(cs);
                stream->discarded_events_state.beginning_cs =
                        bt_clock_snapshot_get_value(cs);
-               cs = NULL;
-               (void) bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
-                       msg, &cs);
+               cs = bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
+                       msg);
                BT_ASSERT(cs);
                stream->discarded_events_state.end_cs =
                        bt_clock_snapshot_get_value(cs);
@@ -722,14 +721,13 @@ bt_self_component_status handle_discarded_packets_msg(
                 * The clock snapshot values will be validated when
                 * handling the next "packet beginning" message.
                 */
-               (void) bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-                       msg, &cs);
+               cs = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
+                       msg);
                BT_ASSERT(cs);
                stream->discarded_packets_state.beginning_cs =
                        bt_clock_snapshot_get_value(cs);
-               cs = NULL;
-               (void) bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
-                       msg, &cs);
+               cs = bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
+                       msg);
                BT_ASSERT(cs);
                stream->discarded_packets_state.end_cs =
                        bt_clock_snapshot_get_value(cs);
index 69c20c6142e169cf61585621f99c2a7651611120..2be99f972400c2e576ca665982662c4fc9e45bdb 100644 (file)
@@ -1166,13 +1166,6 @@ int translate_stream_class(struct fs_sink_ctf_trace_class *tc,
                const char *name = bt_clock_class_get_name(
                        (*out_sc)->default_clock_class);
 
-               if (!bt_stream_class_default_clock_is_always_known(ir_sc)) {
-                       BT_LOGE("Unsupported stream clock which can have an unknown value: "
-                               "sc-name=\"%s\"",
-                               bt_stream_class_get_name(ir_sc));
-                       goto error;
-               }
-
                if (name) {
                        /* Try original name, protected */
                        g_string_assign((*out_sc)->default_clock_class_name,
index d7c1b458336b0bf33d14f917e434668c006ff0c7..e3c1738d00f1fd35e505c9611dbba4eb7b41b4df 100644 (file)
@@ -615,7 +615,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_clock_snapshot_state cs_state = BT_CLOCK_SNAPSHOT_STATE_KNOWN;
        bt_message_stream_activity_clock_snapshot_state sa_cs_state;
 
        BT_ASSERT(msg);
@@ -632,8 +631,8 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter,
                                msg);
                BT_ASSERT(clock_class);
 
-               cs_state = bt_message_event_borrow_default_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_event_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_PACKET_BEGINNING:
                clock_class =
@@ -641,8 +640,8 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter,
                        msg);
                BT_ASSERT(clock_class);
 
-               cs_state = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_PACKET_END:
                clock_class =
@@ -650,8 +649,8 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter,
                        msg);
                BT_ASSERT(clock_class);
 
-               cs_state = bt_message_packet_end_borrow_default_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_packet_end_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
                clock_class =
@@ -659,8 +658,8 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter,
                        msg);
                BT_ASSERT(clock_class);
 
-               cs_state = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
                clock_class =
@@ -668,8 +667,8 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter,
                        msg);
                BT_ASSERT(clock_class);
 
-               cs_state = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
                clock_class =
@@ -698,9 +697,9 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter,
 
                break;
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
-               cs_state =
+               clock_snapshot =
                        bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
-                               msg, &clock_snapshot);
+                               msg);
                break;
        default:
                /* All the other messages have a higher priority */
@@ -709,12 +708,6 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter,
                goto end;
        }
 
-       if (cs_state != BT_CLOCK_SNAPSHOT_STATE_KNOWN) {
-               BT_LOGE_STR("Unsupported unknown clock snapshot.");
-               ret = -1;
-               goto end;
-       }
-
        clock_class = bt_clock_snapshot_borrow_clock_class_const(clock_snapshot);
        BT_ASSERT(clock_class);
 
index 1bdd01e565038dd5a807c6aed7eae9ef01618843..4c2b7b22c0f0cc57c1a1ae89fb885208fe10027d 100644 (file)
@@ -1207,7 +1207,6 @@ bt_message *handle_event_message(struct debug_info_msg_iter *debug_it,
        const bt_clock_snapshot *cs;
        const bt_clock_class *default_cc;
        const bt_packet *in_packet;
-       bt_clock_snapshot_state cs_state;
        bt_event_class *out_event_class;
        bt_packet *out_packet;
        bt_event *out_event;
@@ -1239,12 +1238,10 @@ bt_message *handle_event_message(struct debug_info_msg_iter *debug_it,
                        bt_event_class_borrow_stream_class_const(in_event_class));
        if (default_cc) {
                /* Borrow event clock snapshot. */
-               cs_state =
-                       bt_message_event_borrow_default_clock_snapshot_const(
-                               in_message, &cs);
+               cs = bt_message_event_borrow_default_clock_snapshot_const(
+                               in_message);
 
                /* Create an output event message. */
-               BT_ASSERT (cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
                out_message = bt_message_event_create_with_default_clock_snapshot(
                                        debug_it->input_iterator,
                                        out_event_class, out_packet,
@@ -1338,7 +1335,6 @@ bt_message *handle_packet_begin_message(struct debug_info_msg_iter *debug_it,
                const bt_message *in_message)
 {
        const bt_clock_class *default_cc;
-       bt_clock_snapshot_state cs_state;
        const bt_clock_snapshot *cs;
        bt_message *out_message = NULL;
        bt_packet *out_packet;
@@ -1361,12 +1357,10 @@ bt_message *handle_packet_begin_message(struct debug_info_msg_iter *debug_it,
                                bt_packet_borrow_stream_const(in_packet)));
        if (default_cc) {
                /* Borrow clock snapshot. */
-               cs_state =
-                       bt_message_packet_beginning_borrow_default_clock_snapshot_const(
-                                       in_message, &cs);
+               cs = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
+                                       in_message);
 
                /* Create an output packet beginning message. */
-               BT_ASSERT(cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
                out_message = bt_message_packet_beginning_create_with_default_clock_snapshot(
                                debug_it->input_iterator, out_packet,
                                bt_clock_snapshot_get_value(cs));
@@ -1389,7 +1383,6 @@ bt_message *handle_packet_end_message(struct debug_info_msg_iter *debug_it,
        const bt_clock_snapshot *cs;
        const bt_packet *in_packet;
        const bt_clock_class *default_cc;
-       bt_clock_snapshot_state cs_state;
        bt_message *out_message = NULL;
        bt_packet *out_packet;
 
@@ -1404,12 +1397,10 @@ bt_message *handle_packet_end_message(struct debug_info_msg_iter *debug_it,
                                bt_packet_borrow_stream_const(in_packet)));
        if (default_cc) {
                /* Borrow clock snapshot. */
-               cs_state =
-                       bt_message_packet_end_borrow_default_clock_snapshot_const(
-                                       in_message, &cs);
+               cs = bt_message_packet_end_borrow_default_clock_snapshot_const(
+                                       in_message);
 
                /* Create an outpute packet end message. */
-               BT_ASSERT(cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
                out_message = bt_message_packet_end_create_with_default_clock_snapshot(
                                debug_it->input_iterator, out_packet,
                                bt_clock_snapshot_get_value(cs));
@@ -1549,7 +1540,6 @@ bt_message *handle_discarded_events_message(struct debug_info_msg_iter *debug_it
        const bt_stream *in_stream;
        const bt_clock_class *default_cc;
        uint64_t discarded_events, begin_cs_value, end_cs_value;
-       bt_clock_snapshot_state begin_cs_state, end_cs_state;
        bt_property_availability prop_avail;
        bt_message *out_message = NULL;
        bt_stream *out_stream;
@@ -1565,19 +1555,12 @@ bt_message *handle_discarded_events_message(struct debug_info_msg_iter *debug_it
        default_cc = bt_stream_class_borrow_default_clock_class_const(
                        bt_stream_borrow_class_const(in_stream));
        if (default_cc) {
-               begin_cs_state =
+               begin_cs =
                        bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-                                       in_message, &begin_cs);
-               end_cs_state =
+                               in_message);
+               end_cs =
                        bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
-                                       in_message, &end_cs);
-               /*
-                * Both clock snapshots should be known as we check that the
-                * all input stream classes have an always known clock. Unknown
-                * clock is not yet supported.
-                */
-               BT_ASSERT(begin_cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN &&
-                               end_cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
+                               in_message);
 
                begin_cs_value = bt_clock_snapshot_get_value(begin_cs);
                end_cs_value = bt_clock_snapshot_get_value(end_cs);
@@ -1616,7 +1599,6 @@ bt_message *handle_discarded_packets_message(struct debug_info_msg_iter *debug_i
        const bt_clock_class *default_cc;
        const bt_stream *in_stream;
        uint64_t discarded_packets, begin_cs_value, end_cs_value;
-       bt_clock_snapshot_state begin_cs_state, end_cs_state;
        bt_property_availability prop_avail;
        bt_message *out_message = NULL;
        bt_stream *out_stream;
@@ -1632,21 +1614,13 @@ bt_message *handle_discarded_packets_message(struct debug_info_msg_iter *debug_i
        default_cc = bt_stream_class_borrow_default_clock_class_const(
                        bt_stream_borrow_class_const(in_stream));
        if (default_cc) {
-               begin_cs_state =
+               begin_cs =
                        bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-                                       in_message, &begin_cs);
+                               in_message);
 
-               end_cs_state =
+               end_cs =
                        bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
-                                       in_message, &end_cs);
-
-               /*
-                * Both clock snapshots should be known as we check that the
-                * all input stream classes have an always known clock. Unknown
-                * clock is not yet supported.
-                */
-               BT_ASSERT(begin_cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN &&
-                               end_cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
+                               in_message);
 
                begin_cs_value = bt_clock_snapshot_get_value(begin_cs);
                end_cs_value = bt_clock_snapshot_get_value(end_cs);
index 3ed687c6a6d7c97be9093c90af06859e0b6f8f46..4617b42a3aa63d4f3ec3e8814926b3e9a3abdc3d 100644 (file)
@@ -212,13 +212,6 @@ bt_stream *trace_ir_mapping_create_new_mapped_stream(
        BT_ASSERT(!borrow_mapped_stream(d_maps, in_stream));
 
        in_stream_class = bt_stream_borrow_class_const(in_stream);
-       if (bt_stream_class_default_clock_is_always_known(in_stream_class)
-                       == BT_FALSE) {
-               BT_LOGE("Stream class default clock class is not always "
-                       "known: in-sc-addr=%p", in_stream_class);
-               goto end;
-       }
-
        md_maps = borrow_metadata_maps_from_input_stream_class(ir_maps, in_stream_class);
        out_stream_class = borrow_mapped_stream_class(md_maps, in_stream_class);
        if (!out_stream_class) {
index e779bcc204500c7292612985e44bcfcdf2886aa7..efcf2b885d3d6523f52218e3e86fec0226f12de1 100644 (file)
@@ -226,14 +226,7 @@ int print_event_timestamp(struct pretty_component *pretty,
                goto end;
        }
 
-       if (bt_message_event_borrow_default_clock_snapshot_const(event_msg,
-                       &clock_snapshot) != BT_CLOCK_SNAPSHOT_STATE_KNOWN) {
-               /*
-                * No known default clock value: skip the timestamp
-                * without an error.
-                */
-               goto end;
-       }
+       clock_snapshot = bt_message_event_borrow_default_clock_snapshot_const(event_msg);
 
        if (print_names) {
                print_name_equal(pretty, "timestamp");
@@ -1367,16 +1360,16 @@ int pretty_print_discarded_items(struct pretty_component *pretty,
        if (bt_stream_class_borrow_default_clock_class_const(stream_class)) {
                switch (bt_message_get_type(msg)) {
                case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
-                       bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-                               msg, &begin);
-                       bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
-                               msg, &end);
+                       begin = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
+                               msg);
+                       end = bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
+                               msg);
                        break;
                case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
-                       bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-                               msg, &begin);
-                       bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
-                               msg, &end);
+                       begin = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
+                               msg);
+                       end = bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
+                               msg);
                        break;
                default:
                        abort();
index 7162a6c9b740b620c277c8c694b8a0865b8c441f..b0df3bae188b32d8db126c1d2a6787d230eaacd7 100644 (file)
@@ -505,7 +505,6 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
 {
        const bt_clock_snapshot *clock_snapshot = NULL;
        int ret = 0;
-       bt_clock_snapshot_state cs_state = BT_CLOCK_SNAPSHOT_STATE_KNOWN;
        bt_message_stream_activity_clock_snapshot_state sa_cs_state;
 
        BT_ASSERT(msg);
@@ -525,32 +524,32 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
        case BT_MESSAGE_TYPE_EVENT:
                BT_ASSERT(bt_message_event_borrow_stream_class_default_clock_class_const(
                                msg));
-               cs_state = bt_message_event_borrow_default_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_event_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_PACKET_BEGINNING:
                BT_ASSERT(bt_message_packet_beginning_borrow_stream_class_default_clock_class_const(
                                msg));
-               cs_state = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_PACKET_END:
                BT_ASSERT(bt_message_packet_end_borrow_stream_class_default_clock_class_const(
                                msg));
-               cs_state = bt_message_packet_end_borrow_default_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_packet_end_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
                BT_ASSERT(bt_message_discarded_events_borrow_stream_class_default_clock_class_const(
                                msg));
-               cs_state = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
                BT_ASSERT(bt_message_discarded_packets_borrow_stream_class_default_clock_class_const(
                                msg));
-               cs_state = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
                BT_ASSERT(bt_message_stream_activity_beginning_borrow_stream_class_default_clock_class_const(
@@ -573,9 +572,8 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
 
                break;
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
-               cs_state =
-                       bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
-                               msg, &clock_snapshot);
+               clock_snapshot = bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        default:
                /* All the other messages have a higher priority */
@@ -584,7 +582,6 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
                goto end;
        }
 
-       BT_ASSERT(cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
        ret = bt_clock_snapshot_get_ns_from_origin(clock_snapshot, ts_ns);
        if (ret) {
                BT_LOGE("Cannot get nanoseconds from Epoch of clock snapshot: "
@@ -818,16 +815,6 @@ int validate_new_stream_clock_class(struct muxer_msg_iter *muxer_msg_iter,
                goto end;
        }
 
-       if (!bt_stream_class_default_clock_is_always_known(stream_class)) {
-               BT_LOGE("Stream's default clock is not always known: "
-                       "stream-class-addr=%p, stream-class-name=\"%s\", "
-                       "stream-class-id=%" PRIu64,
-                       stream_class, bt_stream_class_get_name(stream_class),
-                       bt_stream_class_get_id(stream_class));
-               ret = -1;
-               goto end;
-       }
-
        ret = validate_clock_class(muxer_msg_iter, muxer_comp, clock_class);
 
 end:
@@ -907,20 +894,9 @@ muxer_msg_iter_youngest_upstream_msg_iter(
                } else if (unlikely(bt_message_get_type(msg) ==
                                BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY)) {
                        const bt_clock_snapshot *cs;
-                       bt_clock_snapshot_state cs_state;
-
-                       cs_state = bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
-                               msg, &cs);
-
-                       if (cs_state != BT_CLOCK_SNAPSHOT_STATE_KNOWN) {
-                               BT_LOGE("Message iterator inactivity message's "
-                                       "default clock snapshot is unknown: "
-                                       "msg-addr=%p",
-                                       msg);
-                               status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
-                               goto end;
-                       }
 
+                       cs = bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+                               msg);
                        ret = validate_clock_class(muxer_msg_iter, muxer_comp,
                                bt_clock_snapshot_borrow_clock_class_const(cs));
                        if (ret) {
index 0c33c879b2c44f3eb567990eb62323b64fc819a1..4d52e22e08b394d09fe14b615583d757b38cfc93 100644 (file)
@@ -620,7 +620,6 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
 {
        const bt_clock_class *clock_class = NULL;
        const bt_clock_snapshot *clock_snapshot = NULL;
-       bt_clock_snapshot_state cs_state = BT_CLOCK_SNAPSHOT_STATE_KNOWN;
        bt_message_stream_activity_clock_snapshot_state sa_cs_state;
        int ret = 0;
 
@@ -637,8 +636,8 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                        goto error;
                }
 
-               cs_state = bt_message_event_borrow_default_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_event_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_PACKET_BEGINNING:
                clock_class =
@@ -648,8 +647,8 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                        goto error;
                }
 
-               cs_state = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_PACKET_END:
                clock_class =
@@ -659,8 +658,8 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                        goto error;
                }
 
-               cs_state = bt_message_packet_end_borrow_default_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_packet_end_borrow_default_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
                clock_class =
@@ -670,8 +669,8 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                        goto error;
                }
 
-               cs_state = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
                clock_class =
@@ -681,8 +680,8 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                        goto error;
                }
 
-               cs_state = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-                       msg, &clock_snapshot);
+               clock_snapshot = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
+                       msg);
                break;
        case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
                clock_class =
@@ -724,20 +723,14 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
 
                break;
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
-               cs_state =
+               clock_snapshot =
                        bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
-                               msg, &clock_snapshot);
+                               msg);
                break;
        default:
                goto no_clock_snapshot;
        }
 
-       if (unlikely(cs_state != BT_CLOCK_SNAPSHOT_STATE_KNOWN)) {
-               BT_LOGE_STR("Unsupported unknown clock snapshot.");
-               ret = -1;
-               goto end;
-       }
-
        ret = bt_clock_snapshot_get_ns_from_origin(clock_snapshot,
                ns_from_origin);
        if (unlikely(ret)) {
@@ -1431,16 +1424,16 @@ bt_self_message_iterator_status handle_message_with_stream_state(
                         * know there's a default clock and it's always
                         * known.
                         */
-                       (void) bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
-                               msg, &end_cs);
+                       end_cs = bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
+                               msg);
                } else {
                        /*
                         * Safe to ignore the return value because we
                         * know there's a default clock and it's always
                         * known.
                         */
-                       (void) bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
-                               msg, &end_cs);
+                       end_cs = bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
+                               msg);
                }
 
                if (bt_clock_snapshot_get_ns_from_origin(end_cs,
@@ -1482,16 +1475,16 @@ bt_self_message_iterator_status handle_message_with_stream_state(
                        }
 
                        if (msg_type == BT_MESSAGE_TYPE_DISCARDED_EVENTS) {
-                               (void) bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-                                       msg, &begin_cs);
+                               begin_cs = bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
+                                       msg);
                                new_msg = bt_message_discarded_events_create_with_default_clock_snapshots(
                                        trimmer_it->self_msg_iter,
                                        sstate->stream,
                                        bt_clock_snapshot_get_value(begin_cs),
                                        end_raw_value);
                        } else {
-                               (void) bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-                                       msg, &begin_cs);
+                               begin_cs = bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
+                                       msg);
                                new_msg = bt_message_discarded_packets_create_with_default_clock_snapshots(
                                        trimmer_it->self_msg_iter,
                                        sstate->stream,
@@ -1740,18 +1733,6 @@ bt_self_message_iterator_status handle_message(
                                goto end;
                        }
 
-                       if (!bt_stream_class_default_clock_is_always_known(sc)) {
-                               BT_LOGE("Unsupported stream: clock does not "
-                                       "always have a known value: "
-                                       "stream-addr=%p, "
-                                       "stream-id=%" PRIu64 ", "
-                                       "stream-name=\"%s\"",
-                                       stream, bt_stream_get_id(stream),
-                                       bt_stream_get_name(stream));
-                               status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
-                               goto end;
-                       }
-
                        sstate = g_new0(struct trimmer_iterator_stream_state,
                                1);
                        if (!sstate) {
This page took 0.047708 seconds and 4 git commands to generate.