| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef BABELTRACE_CTF_WRITER_CLOCK_CLASS_INTERNAL_H |
| 8 | #define BABELTRACE_CTF_WRITER_CLOCK_CLASS_INTERNAL_H |
| 9 | |
| 10 | #include "common/macros.h" |
| 11 | #include "object-pool.h" |
| 12 | #include "common/uuid.h" |
| 13 | #include <babeltrace2-ctf-writer/types.h> |
| 14 | #include <stdint.h> |
| 15 | #include <glib.h> |
| 16 | |
| 17 | #include "object.h" |
| 18 | |
| 19 | struct bt_ctf_clock_class { |
| 20 | struct bt_ctf_object base; |
| 21 | GString *name; |
| 22 | GString *description; |
| 23 | uint64_t frequency; |
| 24 | uint64_t precision; |
| 25 | int64_t offset_s; /* Offset in seconds */ |
| 26 | int64_t offset; /* Offset in ticks */ |
| 27 | bt_uuid_t uuid; |
| 28 | int uuid_set; |
| 29 | int absolute; |
| 30 | |
| 31 | /* |
| 32 | * A clock's properties can't be modified once it is added to a stream |
| 33 | * class. |
| 34 | */ |
| 35 | int frozen; |
| 36 | }; |
| 37 | |
| 38 | BT_HIDDEN |
| 39 | void bt_ctf_clock_class_freeze(struct bt_ctf_clock_class *clock_class); |
| 40 | |
| 41 | BT_HIDDEN |
| 42 | bt_ctf_bool bt_ctf_clock_class_is_valid(struct bt_ctf_clock_class *clock_class); |
| 43 | |
| 44 | BT_HIDDEN |
| 45 | int bt_ctf_clock_class_compare(struct bt_ctf_clock_class *clock_class_a, |
| 46 | struct bt_ctf_clock_class *clock_class_b); |
| 47 | |
| 48 | BT_HIDDEN |
| 49 | struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name, |
| 50 | uint64_t freq); |
| 51 | BT_HIDDEN |
| 52 | const char *bt_ctf_clock_class_get_name( |
| 53 | struct bt_ctf_clock_class *clock_class); |
| 54 | BT_HIDDEN |
| 55 | int bt_ctf_clock_class_set_name(struct bt_ctf_clock_class *clock_class, |
| 56 | const char *name); |
| 57 | BT_HIDDEN |
| 58 | const char *bt_ctf_clock_class_get_description( |
| 59 | struct bt_ctf_clock_class *clock_class); |
| 60 | BT_HIDDEN |
| 61 | int bt_ctf_clock_class_set_description( |
| 62 | struct bt_ctf_clock_class *clock_class, |
| 63 | const char *desc); |
| 64 | BT_HIDDEN |
| 65 | uint64_t bt_ctf_clock_class_get_frequency( |
| 66 | struct bt_ctf_clock_class *clock_class); |
| 67 | BT_HIDDEN |
| 68 | int bt_ctf_clock_class_set_frequency( |
| 69 | struct bt_ctf_clock_class *clock_class, uint64_t freq); |
| 70 | BT_HIDDEN |
| 71 | uint64_t bt_ctf_clock_class_get_precision( |
| 72 | struct bt_ctf_clock_class *clock_class); |
| 73 | BT_HIDDEN |
| 74 | int bt_ctf_clock_class_set_precision( |
| 75 | struct bt_ctf_clock_class *clock_class, uint64_t precision); |
| 76 | BT_HIDDEN |
| 77 | int bt_ctf_clock_class_get_offset_s( |
| 78 | struct bt_ctf_clock_class *clock_class, int64_t *seconds); |
| 79 | BT_HIDDEN |
| 80 | int bt_ctf_clock_class_set_offset_s( |
| 81 | struct bt_ctf_clock_class *clock_class, int64_t seconds); |
| 82 | BT_HIDDEN |
| 83 | int bt_ctf_clock_class_get_offset_cycles( |
| 84 | struct bt_ctf_clock_class *clock_class, int64_t *cycles); |
| 85 | BT_HIDDEN |
| 86 | int bt_ctf_clock_class_set_offset_cycles( |
| 87 | struct bt_ctf_clock_class *clock_class, int64_t cycles); |
| 88 | BT_HIDDEN |
| 89 | bt_ctf_bool bt_ctf_clock_class_is_absolute( |
| 90 | struct bt_ctf_clock_class *clock_class); |
| 91 | BT_HIDDEN |
| 92 | int bt_ctf_clock_class_set_is_absolute( |
| 93 | struct bt_ctf_clock_class *clock_class, bt_ctf_bool is_absolute); |
| 94 | BT_HIDDEN |
| 95 | const uint8_t *bt_ctf_clock_class_get_uuid( |
| 96 | struct bt_ctf_clock_class *clock_class); |
| 97 | BT_HIDDEN |
| 98 | int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class, |
| 99 | const uint8_t *uuid); |
| 100 | |
| 101 | #endif /* BABELTRACE_CTF_WRITER_CLOCK_CLASS_INTERNAL_H */ |