| 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 | void bt_ctf_clock_class_freeze(struct bt_ctf_clock_class *clock_class); |
| 39 | |
| 40 | bt_ctf_bool bt_ctf_clock_class_is_valid(struct bt_ctf_clock_class *clock_class); |
| 41 | |
| 42 | int bt_ctf_clock_class_compare(struct bt_ctf_clock_class *clock_class_a, |
| 43 | struct bt_ctf_clock_class *clock_class_b); |
| 44 | |
| 45 | struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name, |
| 46 | uint64_t freq); |
| 47 | const char *bt_ctf_clock_class_get_name( |
| 48 | struct bt_ctf_clock_class *clock_class); |
| 49 | int bt_ctf_clock_class_set_name(struct bt_ctf_clock_class *clock_class, |
| 50 | const char *name); |
| 51 | const char *bt_ctf_clock_class_get_description( |
| 52 | struct bt_ctf_clock_class *clock_class); |
| 53 | int bt_ctf_clock_class_set_description( |
| 54 | struct bt_ctf_clock_class *clock_class, |
| 55 | const char *desc); |
| 56 | uint64_t bt_ctf_clock_class_get_frequency( |
| 57 | struct bt_ctf_clock_class *clock_class); |
| 58 | int bt_ctf_clock_class_set_frequency( |
| 59 | struct bt_ctf_clock_class *clock_class, uint64_t freq); |
| 60 | uint64_t bt_ctf_clock_class_get_precision( |
| 61 | struct bt_ctf_clock_class *clock_class); |
| 62 | int bt_ctf_clock_class_set_precision( |
| 63 | struct bt_ctf_clock_class *clock_class, uint64_t precision); |
| 64 | int bt_ctf_clock_class_get_offset_s( |
| 65 | struct bt_ctf_clock_class *clock_class, int64_t *seconds); |
| 66 | int bt_ctf_clock_class_set_offset_s( |
| 67 | struct bt_ctf_clock_class *clock_class, int64_t seconds); |
| 68 | int bt_ctf_clock_class_get_offset_cycles( |
| 69 | struct bt_ctf_clock_class *clock_class, int64_t *cycles); |
| 70 | int bt_ctf_clock_class_set_offset_cycles( |
| 71 | struct bt_ctf_clock_class *clock_class, int64_t cycles); |
| 72 | bt_ctf_bool bt_ctf_clock_class_is_absolute( |
| 73 | struct bt_ctf_clock_class *clock_class); |
| 74 | int bt_ctf_clock_class_set_is_absolute( |
| 75 | struct bt_ctf_clock_class *clock_class, bt_ctf_bool is_absolute); |
| 76 | const uint8_t *bt_ctf_clock_class_get_uuid( |
| 77 | struct bt_ctf_clock_class *clock_class); |
| 78 | int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class, |
| 79 | const uint8_t *uuid); |
| 80 | |
| 81 | #endif /* BABELTRACE_CTF_WRITER_CLOCK_CLASS_INTERNAL_H */ |