lib: add bt_trace_class_get_graph_mip_version
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 31 May 2023 19:59:08 +0000 (15:59 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
Add bt_trace_class_get_graph_mip_version, which returns the MIP version
for the graph the trace class is in.

This will be necessary for the Python bindings functions dealing with
trace IR that need to change their behavior according to the MIP
version.  Right now, the MIP version can be obtained from a self
component.  But some Python functions (for instance
_TraceClass.create_variant_field_class) only have a IR object to work
with, and it's not possible to get the self component from there.
Adding a function to get the self component from a trace class was
considered, but it was deemed to complex because of object lifetime and
refcount cycle issues.

Philippe updated the documentation.

Change-Id: Ie31be7d31baf1242bad3927021de7c949f281247
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10155
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12719

include/babeltrace2/trace-ir/trace-class.h
src/lib/trace-ir/trace-class.c

index 4a50b3115152bfaecc4fd988ca23f28849004fe7..ac425a7f399ac210256113d5c7c72fdfae8ecb60 100644 (file)
@@ -73,6 +73,10 @@ Add to and remove a destruction listener from a trace class with
 bt_trace_class_add_destruction_listener() and
 bt_trace_class_remove_destruction_listener().
 
+Get the effective \bt_mip version of the trace processing \bt_graph
+containing the \bt_comp from which a trace class was created with
+bt_trace_class_get_graph_mip_version().
+
 <h1>Properties</h1>
 
 A trace class has the following properties:
@@ -410,6 +414,27 @@ See bt_trace_class_borrow_user_attributes().
 extern const bt_value *bt_trace_class_borrow_user_attributes_const(
                const bt_trace_class *trace_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{trace_class} was created.
+
+@param[in] trace_class
+    Trace class of which to get the effective MIP version.
+
+@returns
+    Effective MIP version of \bt_p{trace_class}.
+
+@bt_pre_not_null{trace_class}
+
+@sa bt_self_component_get_graph_mip_version() &mdash;
+    Returns the effective MIP version of the trace processing
+    graph which contains a given component.
+*/
+extern uint64_t bt_trace_class_get_graph_mip_version(
+               const bt_trace_class *trace_class) __BT_NOEXCEPT;
+
 /*! @} */
 
 /*!
index 78824ed4aafe8bfd0649fd3b8c3b08390424d8ea..1904585050d42a23f1a919266c7ab48ef0accd3c 100644 (file)
@@ -329,6 +329,14 @@ const struct bt_value *bt_trace_class_borrow_user_attributes_const(
        return trace_class->user_attributes;
 }
 
+BT_EXPORT
+uint64_t bt_trace_class_get_graph_mip_version(
+               const bt_trace_class *trace_class)
+{
+       BT_ASSERT_PRE_DEV_TC_NON_NULL(trace_class);
+       return trace_class->mip_version;
+}
+
 BT_EXPORT
 struct bt_value *bt_trace_class_borrow_user_attributes(
                struct bt_trace_class *trace_class)
This page took 0.028307 seconds and 4 git commands to generate.