lib: Pass raw snapshot value to bt_message_inactivity_create()
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 19 Feb 2019 20:08:26 +0000 (15:08 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
Having both
  bt_message_inactivity_create(bt_self_message_iterator *message_iterator,
      const bt_clock_class *default_clock_class);
and
  bt_message_inactivity_set_default_clock_snapshot(
      bt_message *msg, uint64_t raw_value);
is redundant given that setting the clock snapshot value is required to
send the inactivity message down the graph.

This commit makes it so that the value of the snapshot is required at
the creation of the inactivity message.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
include/babeltrace/graph/message-inactivity.h
lib/graph/message/inactivity.c

index d2d43d011351feadf22e3370c25d2a5324ca851c..e7d1c40403fb17307eba63724c586a2b25131a27 100644 (file)
@@ -35,10 +35,7 @@ extern "C" {
 extern
 bt_message *bt_message_inactivity_create(
                bt_self_message_iterator *message_iterator,
-               const bt_clock_class *default_clock_class);
-
-extern void bt_message_inactivity_set_default_clock_snapshot(
-               bt_message *msg, uint64_t raw_value);
+               const bt_clock_class *default_clock_class, uint64_t raw_value);
 
 #ifdef __cplusplus
 }
index ada6dc67fe2d75a187e4ace3be1129349cf836c2..9cee20e6bba6f4efe5ed0cdf9087689b17b2e17e 100644 (file)
@@ -51,7 +51,8 @@ void bt_message_inactivity_destroy(struct bt_object *obj)
 
 struct bt_message *bt_message_inactivity_create(
                struct bt_self_message_iterator *self_msg_iter,
-               const struct bt_clock_class *default_clock_class)
+               const struct bt_clock_class *default_clock_class,
+               uint64_t value_cycles)
 {
        struct bt_self_component_port_input_message_iterator *msg_iter =
                (void *) self_msg_iter;
@@ -61,8 +62,8 @@ struct bt_message *bt_message_inactivity_create(
        BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
        BT_ASSERT_PRE_NON_NULL(default_clock_class, "Default clock class");
        BT_LIB_LOGD("Creating inactivity message object: "
-               "%![iter-]+i, %![default-cc-]+K", msg_iter,
-               default_clock_class);
+               "%![iter-]+i, %![default-cc-]+K, value=%" PRIu64, msg_iter,
+               default_clock_class, value_cycles);
        message = g_new0(struct bt_message_inactivity, 1);
        if (!message) {
                BT_LOGE_STR("Failed to allocate one inactivity message.");
@@ -77,6 +78,7 @@ struct bt_message *bt_message_inactivity_create(
        if (!message->default_cs) {
                goto error;
        }
+       bt_clock_snapshot_set_raw_value(message->default_cs, value_cycles);
 
        BT_LIB_LOGD("Created inactivity message object: %!+n", ret_msg);
        goto end;
@@ -88,19 +90,6 @@ end:
        return (void *) ret_msg;
 }
 
-void bt_message_inactivity_set_default_clock_snapshot(
-               struct bt_message *msg, uint64_t value_cycles)
-{
-       struct bt_message_inactivity *inactivity = (void *) msg;
-
-       BT_ASSERT_PRE_NON_NULL(msg, "Message");
-       BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_INACTIVITY);
-       BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
-       bt_clock_snapshot_set_raw_value(inactivity->default_cs, value_cycles);
-       BT_LIB_LOGV("Set inactivity message's default clock snapshot: "
-               "%![msg-]+n, value=%" PRIu64, msg, value_cycles);
-}
-
 extern enum bt_clock_snapshot_state
 bt_message_inactivity_borrow_default_clock_snapshot_const(
                const bt_message *msg, const bt_clock_snapshot **snapshot)
This page took 0.029242 seconds and 4 git commands to generate.