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:
#endif
extern const bt_clock_snapshot *
#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
const bt_message *msg);
#ifdef __cplusplus
extern
bt_message *bt_message_message_iterator_inactivity_create(
bt_self_message_iterator *message_iterator,
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);
class _MessageIteratorInactivityMessageConst(
_MessageConst, _MessageWithDefaultClockSnapshot
):
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
- 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.
# 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(
class _MessageIteratorInactivityMessage(
{
struct bt_message_message_iterator_inactivity *inactivity_msg =
(struct bt_message_message_iterator_inactivity *) msg;
{
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:
break;
}
case BT_MESSAGE_TYPE_PACKET_BEGINNING:
const struct bt_message_message_iterator_inactivity *inactivity_msg =
(const void *) msg;
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;
}
BT_ASSERT_DBG(clk_snapshot);
break;
}
BT_LIB_LOGD("Destroying message iterator inactivity message: %!+n",
message);
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;
struct bt_message *bt_message_message_iterator_inactivity_create(
struct bt_self_message_iterator *self_msg_iter,
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 =
uint64_t value_cycles)
{
struct bt_message_iterator *msg_iter =
BT_ASSERT_PRE_DEV_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
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: "
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(
message = g_new0(struct bt_message_message_iterator_inactivity, 1);
if (!message) {
BT_LIB_LOGE_APPEND_CAUSE(
BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY,
bt_message_message_iterator_inactivity_destroy, NULL);
ret_msg = &message->parent;
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) {
- 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);
BT_LIB_LOGD("Created message iterator inactivity message object: %!+n",
ret_msg);
}
extern const struct bt_clock_snapshot *
}
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;
const bt_message *msg)
{
struct bt_message_message_iterator_inactivity *inactivity = (void *) msg;
BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg,
BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY);
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;
struct bt_message_message_iterator_inactivity {
struct bt_message parent;
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 */
};
#endif /* BABELTRACE_GRAPH_MESSAGE_MESSAGE_ITERATOR_INACTIVITY_INTERNAL_H */
case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
{
const bt_clock_snapshot *left_cs =
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 =
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);
ret = compare_clock_snapshots_and_clock_classes(
left_cs, right_cs);
msg);
break;
case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
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(
{
int ret = 0;
const bt_clock_snapshot *cs =
{
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(
break;
case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
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(
BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY)) {
const bt_clock_snapshot *cs;
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));
msg);
ret = validate_clock_class(muxer_msg_iter, muxer_comp,
bt_clock_snapshot_borrow_clock_class_const(cs));
break;
case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
clock_snapshot =
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(
elif i == 3:
self.assertIs(type(msg), bt2._MessageIteratorInactivityMessageConst)
self.assertIs(
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)
elif i == 4:
self.assertIs(type(msg), bt2._DiscardedEventsMessageConst)
self.assertIs(type(msg.stream), bt2_stream._StreamConst)