From b19f538f49b8f392672af316979606e00166e2f3 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 2 Oct 2024 01:12:41 -0400 Subject: [PATCH] plugins/common/muxing: compare clock class identities (MIP 1) Adjust for MIP 1, where clock classes may have identities (namespace, name, UID), instead of UUIDs. Change-Id: I23fe610ae7c85c7dfa2999d102c26ec9188dbeee Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/13311 Reviewed-by: Philippe Proulx Tested-by: jenkins --- src/plugins/common/muxing/muxing.cpp | 19 +++++++++++++------ src/plugins/common/muxing/muxing.hpp | 12 ++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/plugins/common/muxing/muxing.cpp b/src/plugins/common/muxing/muxing.cpp index 700d86db..72a5718e 100644 --- a/src/plugins/common/muxing/muxing.cpp +++ b/src/plugins/common/muxing/muxing.cpp @@ -200,9 +200,13 @@ int MessageComparator::_compareEventClasses(const bt2::ConstEventClass left, } int MessageComparator::_compareClockClasses(const bt2::ConstClockClass left, - const bt2::ConstClockClass right) noexcept + const bt2::ConstClockClass right) const noexcept { - if (const auto ret = _compareOptUuids(left.uuid(), right.uuid())) { + if (_mGraphMipVersion == 0) { + if (const auto ret = _compareOptUuids(left.uuid(), right.uuid())) { + return ret; + } + } else if (const auto ret = _compareIdentities(left.identity(), right.identity())) { return ret; } @@ -222,7 +226,7 @@ int MessageComparator::_compareClockClasses(const bt2::ConstClockClass left, } int MessageComparator::_compareStreamsSameIds(const bt2::ConstStream left, - const bt2::ConstStream right) noexcept + const bt2::ConstStream right) const noexcept { BT_ASSERT_DBG(left.id() == right.id()); @@ -299,8 +303,11 @@ int MessageComparator::_compareStreamsSameIds(const bt2::ConstStream left, } /* Compare the clock classes associated to the stream classes. */ - return _compareOptionalBorrowedObjects(leftCls.defaultClockClass(), - rightCls.defaultClockClass(), _compareClockClasses); + return _compareOptionalBorrowedObjects( + leftCls.defaultClockClass(), rightCls.defaultClockClass(), + [this](const bt2::ConstClockClass leftCc, const bt2::ConstClockClass rightCc) { + return _compareClockClasses(leftCc, rightCc); + }); } int MessageComparator::_compareClockSnapshots(const bt2::ConstClockSnapshot left, @@ -345,7 +352,7 @@ bt2::OptionalBorrowedObject borrowStream(const bt2::ConstMessa } /* namespace */ int MessageComparator::_compareMessagesSameType(const bt2::ConstMessage left, - const bt2::ConstMessage right) noexcept + const bt2::ConstMessage right) const noexcept { BT_ASSERT_DBG(left.type() == right.type()); diff --git a/src/plugins/common/muxing/muxing.hpp b/src/plugins/common/muxing/muxing.hpp index 4859a672..47ce5418 100644 --- a/src/plugins/common/muxing/muxing.hpp +++ b/src/plugins/common/muxing/muxing.hpp @@ -49,14 +49,14 @@ private: const bt2::IdentityView& right) noexcept; static int _compareEventClasses(const bt2::ConstEventClass left, const bt2::ConstEventClass right) noexcept; - static int _compareClockClasses(const bt2::ConstClockClass left, - const bt2::ConstClockClass right) noexcept; - static int _compareStreamsSameIds(const bt2::ConstStream left, - const bt2::ConstStream right) noexcept; + int _compareClockClasses(const bt2::ConstClockClass left, + const bt2::ConstClockClass right) const noexcept; + int _compareStreamsSameIds(const bt2::ConstStream left, + const bt2::ConstStream right) const noexcept; static int _compareClockSnapshots(const bt2::ConstClockSnapshot left, const bt2::ConstClockSnapshot right) noexcept; - static int _compareMessagesSameType(const bt2::ConstMessage left, - const bt2::ConstMessage right) noexcept; + int _compareMessagesSameType(const bt2::ConstMessage left, + const bt2::ConstMessage right) const noexcept; static int _compareMessages(const bt2::ConstMessage left, const bt2::ConstMessage right) noexcept; -- 2.34.1