Make API CTF-agnostic
[babeltrace.git] / include / babeltrace / ctf-ir / clock-class-internal.h
CommitLineData
ac0c6bdd
PP
1#ifndef BABELTRACE_CTF_IR_CLOCK_CLASS_INTERNAL_H
2#define BABELTRACE_CTF_IR_CLOCK_CLASS_INTERNAL_H
273b65be
JG
3
4/*
adc315b8 5 * BabelTrace - CTF IR: Clock internal
273b65be 6 *
de9dd397 7 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
273b65be
JG
8 *
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28 */
29
ac0c6bdd 30#include <babeltrace/ctf-ir/clock-class.h>
83509119 31#include <babeltrace/object-internal.h>
273b65be 32#include <babeltrace/babeltrace-internal.h>
312c056a 33#include <babeltrace/object-pool-internal.h>
3d9990ac 34#include <babeltrace/compat/uuid-internal.h>
c55a9f58 35#include <babeltrace/types.h>
44c440bc 36#include <babeltrace/property-internal.h>
036a7cac
PP
37#include <stdbool.h>
38#include <stdint.h>
c55a9f58 39#include <glib.h>
273b65be 40
50842bdc 41struct bt_clock_class {
83509119 42 struct bt_object base;
44c440bc
PP
43
44 struct {
45 GString *str;
46
47 /* NULL or `str->str` above */
48 const char *value;
49 } name;
50
51 struct {
52 GString *str;
53
54 /* NULL or `str->str` above */
55 const char *value;
56 } description;
57
273b65be
JG
58 uint64_t frequency;
59 uint64_t precision;
44c440bc
PP
60 int64_t offset_seconds;
61 uint64_t offset_cycles;
62
63 struct {
64 uint8_t uuid[BABELTRACE_UUID_LEN];
65
66 /* NULL or `uuid` above */
67 bt_uuid value;
68 } uuid;
69
70 bool is_absolute;
cfeb617e 71
273b65be 72 /*
44c440bc
PP
73 * This is computed every time you call
74 * bt_clock_class_set_frequency() or
75 * bt_clock_class_set_offset(), as well as initially. It is the
76 * base offset in nanoseconds including both `offset_seconds`
77 * and `offset_cycles` above in the result. It is used to
78 * accelerate future calls to
79 * bt_clock_value_get_ns_from_origin() and
80 * bt_clock_class_cycles_to_ns_from_origin().
81 *
82 * `overflows` is true if the base offset cannot be computed
83 * because of an overflow.
273b65be 84 */
44c440bc
PP
85 struct {
86 int64_t value_ns;
87 bool overflows;
88 } base_offset;
312c056a
PP
89
90 /* Pool of `struct bt_clock_value *` */
91 struct bt_object_pool cv_pool;
44c440bc
PP
92
93 bool frozen;
273b65be
JG
94};
95
96BT_HIDDEN
44c440bc 97void _bt_clock_class_freeze(struct bt_clock_class *clock_class);
273b65be 98
44c440bc
PP
99#ifdef BT_DEV_MODE
100# define bt_clock_class_freeze _bt_clock_class_freeze
101#else
102# define bt_clock_class_freeze(_cc)
103#endif
24626e8b 104
93dda901 105BT_HIDDEN
44c440bc 106bt_bool bt_clock_class_is_valid(struct bt_clock_class *clock_class);
93dda901 107
ac0c6bdd 108#endif /* BABELTRACE_CTF_IR_CLOCK_CLASS_INTERNAL_H */
This page took 0.050928 seconds and 4 git commands to generate.