lib: add new clock class origin API
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 23 May 2024 20:23:40 +0000 (16:23 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
commit3f2ebcee9cb9eb3723e0acad69ac3eeb513365c5
tree8e4f84ccc97c07af50073f70db351eff783ca7ab
parentca07a92b5573cac5107c1f47020d999d12c556c3
lib: add new clock class origin API

Add the new API set define the origin of clock classes.  The origin is
now defined as a (namespace, name, unique-id) tuple.

If all three tuple elements are NULL, it means the origin is unknown or
undefined.  Otherwise, the origin is defined, and the name and unique-id
be non-NULL (namespace may be NULL).  There is one well-known origin,
the UNIX epoch, which is represented with the tuple
("babeltrace.org,2020", "unix-epoch", "").

The new API functions are (the numbers in square brackets represent the
MIP versions where these functions are allowed):

 - bt_clock_class_set_origin_unknown [0, 1]
 - bt_clock_class_set_origin_unix_epoch [0, 1]
 - bt_clock_class_set_origin [1]
 - bt_clock_class_get_origin_namespace [1]
 - bt_clock_class_get_origin_name [1]
 - bt_clock_class_get_origin_uid [1]

The existing function bt_clock_class_set_origin_is_unix_epoch (which
accepts a boolean) can still be used with MIP 1.  If passed true, it is
equivalent to bt_clock_class_set_origin_unix_epoch.  If passed false, it
is equivalent to bt_clock_class_set_origin_unknown.

The existing function bt_clock_class_origin_is_unix_epoch can still be
used with MIP 1.

Implementation-wise, replace the origin_is_unix_epoch boolean in struct
clock_class with the tuple of three strings.  The behavior of the API
for MIP 0 doesn't change, even if the underlying implementation does.
With MIP 0, the user is still restricted to set or get whether the
origin is the UNIX epoch or is unknown, and can't access the individual
components of the origin.

Philippe updated the documentation.

Change-Id: I1225b89a679952e877583ec8147008928a16eb45
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12677
Tested-by: jenkins <jenkins@lttng.org>
doc/api/libbabeltrace2/Doxyfile.in
include/babeltrace2/trace-ir/clock-class.h
src/lib/assert-cond.h
src/lib/lib-logging.c
src/lib/trace-ir/clock-class.c
src/lib/trace-ir/clock-class.h
This page took 0.024512 seconds and 4 git commands to generate.