Babeltrace 2 C API  2.1.1
Open-source trace manipulation framework
clock-class.h
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5  */
6 
7 #ifndef BABELTRACE2_TRACE_IR_CLOCK_CLASS_H
8 #define BABELTRACE2_TRACE_IR_CLOCK_CLASS_H
9 
10 /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11 
12 #ifndef __BT_IN_BABELTRACE_H
13 # error "Please include <babeltrace2/babeltrace.h> instead."
14 #endif
15 
16 #include <stdint.h>
17 
18 #include <babeltrace2/types.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
450  __BT_NOEXCEPT;
451 
485 extern void bt_clock_class_set_frequency(bt_clock_class *clock_class,
486  uint64_t frequency) __BT_NOEXCEPT;
487 
505 extern uint64_t bt_clock_class_get_frequency(
506  const bt_clock_class *clock_class) __BT_NOEXCEPT;
507 
533 extern void bt_clock_class_set_offset(bt_clock_class *clock_class,
534  int64_t offset_seconds, uint64_t offset_cycles) __BT_NOEXCEPT;
535 
560 extern void bt_clock_class_get_offset(const bt_clock_class *clock_class,
561  int64_t *offset_seconds, uint64_t *offset_cycles) __BT_NOEXCEPT;
562 
581 extern void bt_clock_class_set_precision(bt_clock_class *clock_class,
582  uint64_t precision) __BT_NOEXCEPT;
583 
611 extern uint64_t bt_clock_class_get_precision(
612  const bt_clock_class *clock_class) __BT_NOEXCEPT;
613 
645  const struct bt_clock_class *clock_class,
646  uint64_t *precision) __BT_NOEXCEPT;
647 
669 extern void bt_clock_class_set_accuracy(bt_clock_class *clock_class,
670  uint64_t accuracy) __BT_NOEXCEPT;
671 
703  const struct bt_clock_class *clock_class,
704  uint64_t *accuracy) __BT_NOEXCEPT;
705 
742  bt_bool origin_is_unix_epoch) __BT_NOEXCEPT;
743 
766 extern void
767 bt_clock_class_set_origin_unknown(bt_clock_class *clock_class) __BT_NOEXCEPT;
768 
793 extern void
794 bt_clock_class_set_origin_unix_epoch(bt_clock_class *clock_class) __BT_NOEXCEPT;
795 
807  BT_CLOCK_CLASS_SET_ORIGIN_STATUS_OK = __BT_FUNC_STATUS_OK,
808 
813  BT_CLOCK_CLASS_SET_ORIGIN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
815 
871  bt_clock_class *clock_class, const char *ns, const char *name,
872  const char *uid) __BT_NOEXCEPT;
873 
905  const bt_clock_class *clock_class) __BT_NOEXCEPT;
906 
936  const bt_clock_class *clock_class) __BT_NOEXCEPT;
937 
974 extern const char *bt_clock_class_get_origin_namespace(
975  const bt_clock_class *clock_class) __BT_NOEXCEPT;
976 
1016 extern const char *bt_clock_class_get_origin_name(
1017  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1018 
1058 extern const char *bt_clock_class_get_origin_uid(
1059  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1060 
1073 
1078  BT_CLOCK_CLASS_SET_NAMESPACE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
1080 
1109  bt_clock_class *clock_class, const char *ns) __BT_NOEXCEPT;
1110 
1139 extern const char *bt_clock_class_get_namespace(
1140  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1141 
1151  BT_CLOCK_CLASS_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
1152 
1157  BT_CLOCK_CLASS_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
1159 
1185  bt_clock_class *clock_class, const char *name) __BT_NOEXCEPT;
1186 
1211 extern const char *bt_clock_class_get_name(
1212  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1213 
1225  BT_CLOCK_CLASS_SET_UID_STATUS_OK = __BT_FUNC_STATUS_OK,
1226 
1231  BT_CLOCK_CLASS_SET_UID_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
1233 
1263  bt_clock_class *clock_class, const char *uid) __BT_NOEXCEPT;
1264 
1292 extern const char *
1293 bt_clock_class_get_uid(const bt_clock_class *clock_class) __BT_NOEXCEPT;
1294 
1327  const bt_clock_class *clock_class_a,
1328  const bt_clock_class *clock_class_b) __BT_NOEXCEPT;
1329 
1340 
1347 
1374 extern void bt_clock_class_set_uuid(bt_clock_class *clock_class,
1375  bt_uuid uuid) __BT_NOEXCEPT;
1376 
1408  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1409 
1435  bt_clock_class *clock_class, const char *description)
1436  __BT_NOEXCEPT;
1437 
1463 extern const char *bt_clock_class_get_description(
1464  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1465 
1496  bt_clock_class *clock_class, const bt_value *user_attributes)
1497  __BT_NOEXCEPT;
1498 
1525  bt_clock_class *clock_class) __BT_NOEXCEPT;
1526 
1535  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1536 
1564 extern uint64_t bt_clock_class_get_graph_mip_version(
1565  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1566 
1584 
1591 
1644  const bt_clock_class *clock_class,
1645  uint64_t value, int64_t *ns_from_origin) __BT_NOEXCEPT;
1646 
1669 extern void bt_clock_class_get_ref(
1670  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1671 
1687 extern void bt_clock_class_put_ref(
1688  const bt_clock_class *clock_class) __BT_NOEXCEPT;
1689 
1704 #define BT_CLOCK_CLASS_PUT_REF_AND_RESET(_clock_class) \
1705  do { \
1706  bt_clock_class_put_ref(_clock_class); \
1707  (_clock_class) = NULL; \
1708  } while (0)
1709 
1735 #define BT_CLOCK_CLASS_MOVE_REF(_dst, _src) \
1736  do { \
1737  bt_clock_class_put_ref(_dst); \
1738  (_dst) = (_src); \
1739  (_src) = NULL; \
1740  } while (0)
1741 
1746 #ifdef __cplusplus
1747 }
1748 #endif
1749 
1750 #endif /* BABELTRACE2_TRACE_IR_CLOCK_CLASS_H */
Success.
Definition: clock-class.h:1151
const char * bt_clock_class_get_origin_uid(const bt_clock_class *clock_class)
Returns the UID of the custom origin of the clock class clock_class.
void bt_clock_class_set_user_attributes(bt_clock_class *clock_class, const bt_value *user_attributes)
Sets the user attributes of the clock class clock_class to user_attributes.
bt_clock_class_set_uid_status bt_clock_class_set_uid(bt_clock_class *clock_class, const char *uid)
Sets the unique identifier (UID) of the clock class clock_class to a copy of uid. ...
Success.
Definition: clock-class.h:1339
const char * bt_clock_class_get_description(const bt_clock_class *clock_class)
Returns the description of the clock class clock_class.
struct bt_self_component bt_self_component
Self component.
Definition: types.h:71
bt_property_availability bt_clock_class_get_opt_precision(const struct bt_clock_class *clock_class, uint64_t *precision)
Returns the precision of the clock class clock_class.
bt_bool bt_clock_class_origin_is_known(const bt_clock_class *clock_class)
Returns whether or not the origin of the clock class clock_class is known.
bt_property_availability
Availability of an object property.
Definition: types.h:159
bt_property_availability bt_clock_class_get_accuracy(const struct bt_clock_class *clock_class, uint64_t *accuracy)
Returns the accuracy of the clock class clock_class.
bt_bool bt_clock_class_origin_is_unix_epoch(const bt_clock_class *clock_class)
Returns whether or not the origin of the clock class clock_class is the Unix epoch.
bt_clock_class_set_name_status
Status codes for bt_clock_class_set_name().
Definition: clock-class.h:1146
bt_clock_class_cycles_to_ns_from_origin_status
Status codes for bt_clock_class_cycles_to_ns_from_origin().
Definition: clock-class.h:1578
void bt_clock_class_set_origin_is_unix_epoch(bt_clock_class *clock_class, bt_bool origin_is_unix_epoch)
Sets whether the origin of the clock class clock_class is unknown or the Unix epoch.
void bt_clock_class_set_origin_unix_epoch(bt_clock_class *clock_class)
Makes the origin of the clock class clock_class the Unix epoch.
bt_clock_class_set_uid_status
Status codes for bt_clock_class_set_uid().
Definition: clock-class.h:1220
uint64_t bt_clock_class_get_precision(const bt_clock_class *clock_class)
Returns the precision (cycles) of the clock class clock_class.
void bt_clock_class_get_ref(const bt_clock_class *clock_class)
Increments the reference count of the clock class clock_class.
const char * bt_clock_class_get_name(const bt_clock_class *clock_class)
Returns the name of the clock class clock_class.
const char * bt_clock_class_get_namespace(const bt_clock_class *clock_class)
Returns the namespace of the clock class clock_class.
void bt_clock_class_set_precision(bt_clock_class *clock_class, uint64_t precision)
Sets the precision (cycles) of the clock class clock_class to precision.
const char * bt_clock_class_get_uid(const bt_clock_class *clock_class)
Returns the UID of the clock class clock_class.
Success.
Definition: clock-class.h:807
bt_uuid bt_clock_class_get_uuid(const bt_clock_class *clock_class)
Returns the UUID of the clock class clock_class.
void bt_clock_class_set_uuid(bt_clock_class *clock_class, bt_uuid uuid)
Sets the UUID of the clock class clock_class to a copy of uuid.
Success.
Definition: clock-class.h:1225
uint64_t bt_clock_class_get_frequency(const bt_clock_class *clock_class)
Returns the frequency (Hz) of the clock class clock_class.
void bt_clock_class_put_ref(const bt_clock_class *clock_class)
Decrements the reference count of the clock class clock_class.
bt_value * bt_clock_class_borrow_user_attributes(bt_clock_class *clock_class)
Borrows the user attributes of the clock class clock_class.
struct bt_value bt_value
Value.
Definition: types.h:93
void bt_clock_class_set_accuracy(bt_clock_class *clock_class, uint64_t accuracy)
Sets the accuracy (cycles) of the clock class clock_class to accuracy.
Success.
Definition: clock-class.h:1072
bt_clock_class_set_origin_status bt_clock_class_set_origin(bt_clock_class *clock_class, const char *ns, const char *name, const char *uid)
Sets the custom origin of the clock class clock_class to the ns, name, and uid tuple.
int bt_bool
Babeltrace 2 boolean type.
Definition: types.h:126
uint64_t bt_clock_class_get_graph_mip_version(const bt_clock_class *clock_class)
Returns the effective Message Interchange Protocol (MIP) version of the trace processing graph contai...
bt_clock_class_set_namespace_status
Status codes for bt_clock_class_set_namespace().
Definition: clock-class.h:1067
const char * bt_clock_class_get_origin_namespace(const bt_clock_class *clock_class)
Returns the namespace of the custom origin of the clock class clock_class.
Success.
Definition: clock-class.h:1583
Out of memory.
Definition: clock-class.h:1345
void bt_clock_class_get_offset(const bt_clock_class *clock_class, int64_t *offset_seconds, uint64_t *offset_cycles)
Returns the offsets in seconds and cycles of the clock class clock_class.
const bt_value * bt_clock_class_borrow_user_attributes_const(const bt_clock_class *clock_class)
Borrows the user attributes of the clock class clock_class (const version).
bt_clock_class * bt_clock_class_create(bt_self_component *self_component)
Creates a default clock class from the self component self_component.
bt_clock_class_set_origin_status
Status codes for bt_clock_class_set_origin().
Definition: clock-class.h:802
Out of memory.
Definition: clock-class.h:813
bt_clock_class_set_name_status bt_clock_class_set_name(bt_clock_class *clock_class, const char *name)
Sets the name of the clock class clock_class to a copy of name.
bt_clock_class_set_namespace_status bt_clock_class_set_namespace(bt_clock_class *clock_class, const char *ns)
Sets the namespace of the clock class clock_class to a copy of ns.
Out of memory.
Definition: clock-class.h:1078
bt_clock_class_cycles_to_ns_from_origin_status bt_clock_class_cycles_to_ns_from_origin(const bt_clock_class *clock_class, uint64_t value, int64_t *ns_from_origin)
Converts the stream clock value value from cycles to nanoseconds from the origin of the clock class c...
Out of memory.
Definition: clock-class.h:1231
const char * bt_clock_class_get_origin_name(const bt_clock_class *clock_class)
Returns the name of the custom origin of the clock class clock_class.
Integer overflow while computing the result.
Definition: clock-class.h:1589
Out of memory.
Definition: clock-class.h:1157
bt_bool bt_clock_class_has_same_identity(const bt_clock_class *clock_class_a, const bt_clock_class *clock_class_b)
Returns whether or not the clock classes clock_class_a and clock_class_b share the same identity...
bt_clock_class_set_description_status bt_clock_class_set_description(bt_clock_class *clock_class, const char *description)
Sets the description of the clock class clock_class to a copy of description.
void bt_clock_class_set_frequency(bt_clock_class *clock_class, uint64_t frequency)
Sets the frequency (Hz) of the clock class clock_class to frequency.
bt_clock_class_set_description_status
Status codes for bt_clock_class_set_description().
Definition: clock-class.h:1334
void bt_clock_class_set_origin_unknown(bt_clock_class *clock_class)
Makes the origin of the clock class clock_class unknown.
void bt_clock_class_set_offset(bt_clock_class *clock_class, int64_t offset_seconds, uint64_t offset_cycles)
Sets the offset of the clock class clock_class to offset_seconds plus offset_cycles from its origin...
struct bt_clock_class bt_clock_class
Clock class.
Definition: types.h:22
uint8_t const * bt_uuid
A UUID, that is, an array of 16 constant bytes.
Definition: types.h:144