From b998522ab113bf63e64c1a00c7fc7fd97747c1a4 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 22 Oct 2024 15:48:45 -0400 Subject: [PATCH] lib: add bt_clock_class_get_graph_mip_version() Add bt_clock_class_get_graph_mip_version, which returns the MIP version for the graph the clock class is in, for the same reason as explained in fbc90342dade ("lib: add bt_trace_class_get_graph_mip_version") for trace class. Signed-off-by: Simon Marchi Change-Id: I6949c47e39b2c4dfc8e0d55ab701e6eef9fb0d45 Reviewed-on: https://review.lttng.org/c/babeltrace/+/13394 Reviewed-by: Philippe Proulx --- include/babeltrace2/trace-ir/clock-class.h | 21 +++++++++++++++++++++ src/lib/trace-ir/clock-class.c | 8 ++++++++ 2 files changed, 29 insertions(+) diff --git a/include/babeltrace2/trace-ir/clock-class.h b/include/babeltrace2/trace-ir/clock-class.h index f1861dee..da2d327a 100644 --- a/include/babeltrace2/trace-ir/clock-class.h +++ b/include/babeltrace2/trace-ir/clock-class.h @@ -1479,6 +1479,27 @@ See bt_clock_class_borrow_user_attributes(). extern const bt_value *bt_clock_class_borrow_user_attributes_const( const bt_clock_class *clock_class) __BT_NOEXCEPT; +/*! +@brief + Returns the effective \bt_mip (MIP) version of the trace processing + \bt_graph containing the \bt_comp from which + \bt_p{clock_class} was created. + +@param[in] clock_class + Clock class of which to get the effective MIP version. + +@returns + Effective MIP version of \bt_p{clock_class}. + +@bt_pre_not_null{clock_class} + +@sa bt_self_component_get_graph_mip_version() — + Returns the effective MIP version of the trace processing + graph which contains a given component. +*/ +extern uint64_t bt_clock_class_get_graph_mip_version( + const bt_clock_class *clock_class) __BT_NOEXCEPT; + /*! @} */ /*! diff --git a/src/lib/trace-ir/clock-class.c b/src/lib/trace-ir/clock-class.c index 70777b8c..d642f033 100644 --- a/src/lib/trace-ir/clock-class.c +++ b/src/lib/trace-ir/clock-class.c @@ -614,6 +614,14 @@ void bt_clock_class_set_user_attributes( bt_object_get_ref_no_null_check(clock_class->user_attributes); } +BT_EXPORT +uint64_t bt_clock_class_get_graph_mip_version( + const bt_clock_class *clock_class) +{ + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); + return clock_class->mip_version; +} + BT_EXPORT void bt_clock_class_get_ref(const struct bt_clock_class *clock_class) { -- 2.34.1