Commit | Line | Data |
---|---|---|
56e18c4c PP |
1 | #ifndef BABELTRACE_TRACE_IR_TRACE_INTERNAL_H |
2 | #define BABELTRACE_TRACE_IR_TRACE_INTERNAL_H | |
daf01357 JG |
3 | |
4 | /* | |
56e18c4c | 5 | * BabelTrace - Trace IR: Trace internal |
daf01357 JG |
6 | * |
7 | * Copyright 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
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 | ||
3dca2276 | 30 | #include <babeltrace/assert-pre-internal.h> |
56e18c4c PP |
31 | #include <babeltrace/trace-ir/trace.h> |
32 | #include <babeltrace/trace-ir/stream-class-internal.h> | |
33 | #include <babeltrace/trace-ir/field-types.h> | |
34 | #include <babeltrace/trace-ir/fields.h> | |
35 | #include <babeltrace/trace-ir/attributes-internal.h> | |
36 | #include <babeltrace/trace-ir/clock-class-internal.h> | |
83509119 | 37 | #include <babeltrace/object-internal.h> |
312c056a | 38 | #include <babeltrace/object-pool-internal.h> |
daf01357 | 39 | #include <babeltrace/babeltrace-internal.h> |
dac5c838 | 40 | #include <babeltrace/values.h> |
c55a9f58 | 41 | #include <babeltrace/types.h> |
daf01357 JG |
42 | #include <glib.h> |
43 | #include <sys/types.h> | |
20eee76e | 44 | #include <babeltrace/compat/uuid-internal.h> |
daf01357 | 45 | |
cb6f1f7d | 46 | struct bt_trace { |
83509119 | 47 | struct bt_object base; |
44c440bc PP |
48 | |
49 | struct { | |
50 | GString *str; | |
51 | ||
52 | /* NULL or `str->str` above */ | |
53 | const char *value; | |
54 | } name; | |
55 | ||
56 | struct { | |
57 | uint8_t uuid[BABELTRACE_UUID_LEN]; | |
58 | ||
59 | /* NULL or `uuid` above */ | |
60 | bt_uuid value; | |
61 | } uuid; | |
62 | ||
dac5c838 | 63 | struct bt_value *environment; |
44c440bc PP |
64 | |
65 | /* Array of `struct bt_stream_class *` */ | |
66 | GPtrArray *stream_classes; | |
67 | ||
68 | /* Array of `struct bt_stream *` */ | |
69 | GPtrArray *streams; | |
09840de5 PP |
70 | |
71 | /* | |
44c440bc PP |
72 | * Stream class (weak) to number of instantiated streams, used |
73 | * to automatically assign stream IDs per stream class. | |
09840de5 | 74 | */ |
44c440bc PP |
75 | GHashTable *stream_classes_stream_count; |
76 | ||
77 | struct bt_field_type *packet_header_ft; | |
78 | bool assigns_automatic_stream_class_id; | |
3dca2276 | 79 | |
3602afb0 | 80 | GArray *is_static_listeners; |
44c440bc PP |
81 | bool is_static; |
82 | bool in_remove_listener; | |
312c056a PP |
83 | |
84 | /* Pool of `struct bt_field_wrapper *` */ | |
85 | struct bt_object_pool packet_header_field_pool; | |
daf01357 | 86 | |
44c440bc PP |
87 | bool frozen; |
88 | }; | |
9b888ff3 | 89 | |
c9d90a34 | 90 | BT_HIDDEN |
44c440bc | 91 | void _bt_trace_freeze(struct bt_trace *trace); |
3230ee6b | 92 | |
44c440bc PP |
93 | #ifdef BT_DEV_MODE |
94 | # define bt_trace_freeze _bt_trace_freeze | |
95 | #else | |
96 | # define bt_trace_freeze(_trace) | |
97 | #endif | |
3230ee6b | 98 | |
44c440bc PP |
99 | BT_HIDDEN |
100 | void bt_trace_add_stream(struct bt_trace *trace, struct bt_stream *stream); | |
3230ee6b | 101 | |
5b876b06 | 102 | BT_HIDDEN |
44c440bc PP |
103 | uint64_t bt_trace_get_automatic_stream_id(struct bt_trace *trace, |
104 | struct bt_stream_class *stream_class); | |
3dca2276 | 105 | |
56e18c4c | 106 | #endif /* BABELTRACE_TRACE_IR_TRACE_INTERNAL_H */ |