lib: msg. iter. inactivity message has a simple CS, not a default CS
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 14 Jan 2020 18:36:51 +0000 (13:36 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 20 Jan 2020 20:15:24 +0000 (15:15 -0500)
The "default clock snapshot" properties of some types of messages come
from the fact that a stream class has a default clock class, and
therefore its streams have a default clock.

A message iterator inactivity message is not related to any stream, so
it doesn't have a "default" clock class: it has a simple clock class,
and therefore a simple clock snapshot.

Update the C and Python APIs to show this.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I0142c4f91217791e3157d37a32f4e2f234afa8d2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2801
Tested-by: jenkins <jenkins@lttng.org>
12 files changed:
include/babeltrace2/graph/message-message-iterator-inactivity-const.h
include/babeltrace2/graph/message-message-iterator-inactivity.h
src/bindings/python/bt2/bt2/message.py
src/lib/graph/iterator.c
src/lib/graph/message/message-iterator-inactivity.c
src/lib/graph/message/message-iterator-inactivity.h
src/plugins/common/muxing/muxing.c
src/plugins/ctf/lttng-live/lttng-live.c
src/plugins/text/details/write.c
src/plugins/utils/muxer/muxer.c
src/plugins/utils/trimmer/trimmer.c
tests/bindings/python/bt2/test_message.py

index 43b29da71af528ac2173bacd7c4c83f69e45a061..ce5ed33787ed6590e0f11234c06f7996931fd0d3 100644 (file)
@@ -34,7 +34,7 @@ extern "C" {
 #endif
 
 extern const bt_clock_snapshot *
-bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(
                const bt_message *msg);
 
 #ifdef __cplusplus
index 5edffd0af5dc5ae9c47feee3f48000210ec49ce0..dba7c4a445e045f4afa014c8cc5f6581be5b3383 100644 (file)
@@ -38,7 +38,7 @@ extern "C" {
 extern
 bt_message *bt_message_message_iterator_inactivity_create(
                bt_self_message_iterator *message_iterator,
-               const bt_clock_class *default_clock_class, uint64_t raw_value);
+               const bt_clock_class *clock_class, uint64_t raw_value);
 
 #ifdef __cplusplus
 }
index cdf18879672414f3f1902949c889a2ce0e05376b..fd92361dd69371981310b21792e76dafa363a22d 100644 (file)
@@ -195,15 +195,15 @@ class _StreamEndMessage(_StreamMessage):
 class _MessageIteratorInactivityMessageConst(
     _MessageConst, _MessageWithDefaultClockSnapshot
 ):
-    _borrow_default_clock_snapshot_ptr = staticmethod(
-        native_bt.message_message_iterator_inactivity_borrow_default_clock_snapshot_const
+    _borrow_clock_snapshot_ptr = staticmethod(
+        native_bt.message_message_iterator_inactivity_borrow_clock_snapshot_const
     )
 
     @property
-    def default_clock_snapshot(self):
-        # This kind of message always has a default clock class: no
+    def clock_snapshot(self):
+        # This kind of message always has a clock class: no
         # need to call self._check_has_default_clock_class() here.
-        return self._get_default_clock_snapshot(self._borrow_default_clock_snapshot_ptr)
+        return self._get_default_clock_snapshot(self._borrow_clock_snapshot_ptr)
 
 
 class _MessageIteratorInactivityMessage(
index 615373196063f1b9b53243a61412edf6cf609830..5b2ebfbdacaa43c0c45c0fc525343688cac97018 100644 (file)
@@ -563,7 +563,7 @@ bool clock_snapshots_are_monotonic_one(
        {
                struct bt_message_message_iterator_inactivity *inactivity_msg =
                        (struct bt_message_message_iterator_inactivity *) msg;
-               clock_snapshot = inactivity_msg->default_cs;
+               clock_snapshot = inactivity_msg->cs;
                break;
        }
        case BT_MESSAGE_TYPE_PACKET_BEGINNING:
@@ -1261,7 +1261,7 @@ int auto_seek_handle_message(
                const struct bt_message_message_iterator_inactivity *inactivity_msg =
                        (const void *) msg;
 
-               clk_snapshot = inactivity_msg->default_cs;
+               clk_snapshot = inactivity_msg->cs;
                BT_ASSERT_DBG(clk_snapshot);
                break;
        }
index 94964019fd86f2056402a05f56c0960430708d97..d0c27e3d7c083738144894e0b57db543f971de67 100644 (file)
@@ -43,9 +43,9 @@ void bt_message_message_iterator_inactivity_destroy(struct bt_object *obj)
        BT_LIB_LOGD("Destroying message iterator inactivity message: %!+n",
                message);
 
-       if (message->default_cs) {
-               bt_clock_snapshot_recycle(message->default_cs);
-               message->default_cs = NULL;
+       if (message->cs) {
+               bt_clock_snapshot_recycle(message->cs);
+               message->cs = NULL;
        }
 
        g_free(message);
@@ -53,7 +53,7 @@ void bt_message_message_iterator_inactivity_destroy(struct bt_object *obj)
 
 struct bt_message *bt_message_message_iterator_inactivity_create(
                struct bt_self_message_iterator *self_msg_iter,
-               const struct bt_clock_class *default_clock_class,
+               const struct bt_clock_class *clock_class,
                uint64_t value_cycles)
 {
        struct bt_message_iterator *msg_iter =
@@ -63,10 +63,10 @@ struct bt_message *bt_message_message_iterator_inactivity_create(
 
        BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
-       BT_ASSERT_PRE_NON_NULL(default_clock_class, "Default clock class");
+       BT_ASSERT_PRE_NON_NULL(clock_class, "Default clock class");
        BT_LIB_LOGD("Creating message iterator inactivity message object: "
-               "%![iter-]+i, %![default-cc-]+K, value=%" PRIu64, msg_iter,
-               default_clock_class, value_cycles);
+               "%![iter-]+i, %![cc-]+K, value=%" PRIu64, msg_iter,
+               clock_class, value_cycles);
        message = g_new0(struct bt_message_message_iterator_inactivity, 1);
        if (!message) {
                BT_LIB_LOGE_APPEND_CAUSE(
@@ -78,12 +78,12 @@ struct bt_message *bt_message_message_iterator_inactivity_create(
                BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY,
                bt_message_message_iterator_inactivity_destroy, NULL);
        ret_msg = &message->parent;
-       message->default_cs = bt_clock_snapshot_create(
-               (void *) default_clock_class);
-       if (!message->default_cs) {
+       message->cs = bt_clock_snapshot_create(
+               (void *) clock_class);
+       if (!message->cs) {
                goto error;
        }
-       bt_clock_snapshot_set_raw_value(message->default_cs, value_cycles);
+       bt_clock_snapshot_set_raw_value(message->cs, value_cycles);
 
        BT_LIB_LOGD("Created message iterator inactivity message object: %!+n",
                ret_msg);
@@ -97,7 +97,7 @@ end:
 }
 
 extern const struct bt_clock_snapshot *
-bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(
                const bt_message *msg)
 {
        struct bt_message_message_iterator_inactivity *inactivity = (void *) msg;
@@ -105,5 +105,5 @@ bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
        BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
        BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg,
                BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY);
-       return inactivity->default_cs;
+       return inactivity->cs;
 }
index 12806bfb78cc594d4aa85c29ba0335db88bb8a08..6e8c1fdd42d301afa3f89af197e0165d9ece28d4 100644 (file)
@@ -29,7 +29,7 @@
 
 struct bt_message_message_iterator_inactivity {
        struct bt_message parent;
-       struct bt_clock_snapshot *default_cs;
+       struct bt_clock_snapshot *cs;
 };
 
 #endif /* BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_INTERNAL_H */
index 93ba1a34e00cb25f48d5a432f664f10dbd3b6335..cd97798acc0309a3b77a0a0fc028119e8bd883a5 100644 (file)
@@ -820,9 +820,9 @@ int compare_messages_same_type(struct messages_to_compare *msgs)
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
        {
                const bt_clock_snapshot *left_cs =
-                       bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(msgs->left.msg);
+                       bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(msgs->left.msg);
                const bt_clock_snapshot *right_cs =
-                       bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(msgs->right.msg);
+                       bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(msgs->right.msg);
 
                ret = compare_clock_snapshots_and_clock_classes(
                        left_cs, right_cs);
index d812e818f24c2177672400946ab5f7e852f9328c..35e1037f6569c613cfd744c819a4a1ffedc1040b 100644 (file)
@@ -740,7 +740,7 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter,
                        msg);
                break;
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
-               clock_snapshot = bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+               clock_snapshot = bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(
                        msg);
                break;
        default:
index b98efb78c4d55e0afb42816ff719feecfccd7553..6d555a5f1b488c50bcdcdc9cf15fbe1c1e69555e 100644 (file)
@@ -2512,7 +2512,7 @@ int write_message_iterator_inactivity_message(struct details_write_ctx *ctx,
 {
        int ret = 0;
        const bt_clock_snapshot *cs =
-               bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+               bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(
                        msg);
 
        /* Write time */
index 2554d2705a561c23b64ff6c2162d53bc62f642dc..26fb3b6e84e2a3537d8b94716f1fe9f1b49b2886 100644 (file)
@@ -580,7 +580,7 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
 
                break;
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
-               clock_snapshot = bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+               clock_snapshot = bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(
                        msg);
                break;
        default:
@@ -852,7 +852,7 @@ muxer_msg_iter_youngest_upstream_msg_iter(
                                BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY)) {
                        const bt_clock_snapshot *cs;
 
-                       cs = bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+                       cs = bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(
                                msg);
                        ret = validate_clock_class(muxer_msg_iter, muxer_comp,
                                bt_clock_snapshot_borrow_clock_class_const(cs));
index e46884de389590eb4d810e01042dde3a0ad88246..ce69f97170687290fa25ffe014621d7820c5d7f4 100644 (file)
@@ -879,7 +879,7 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                break;
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
                clock_snapshot =
-                       bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+                       bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(
                                msg);
                break;
        default:
index 012c851f0ea5e64f95bbb72e47dff9fc5e5b9426..7c26a935536e5e9b2fe3a9bec9c6fa922328c66d 100644 (file)
@@ -215,10 +215,9 @@ class AllMessagesTestCase(unittest.TestCase):
             elif i == 3:
                 self.assertIs(type(msg), bt2._MessageIteratorInactivityMessageConst)
                 self.assertIs(
-                    type(msg.default_clock_snapshot),
-                    bt2_clock_snapshot._ClockSnapshotConst,
+                    type(msg.clock_snapshot), bt2_clock_snapshot._ClockSnapshotConst
                 )
-                self.assertEqual(msg.default_clock_snapshot.value, i)
+                self.assertEqual(msg.clock_snapshot.value, i)
             elif i == 4:
                 self.assertIs(type(msg), bt2._DiscardedEventsMessageConst)
                 self.assertIs(type(msg.stream), bt2_stream._StreamConst)
This page took 0.031692 seconds and 4 git commands to generate.