81bcbd7fa36e3824a29dd595bd8b6e4be760a084
[babeltrace.git] / src / lib / trace-ir / trace.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
5 * Copyright 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 */
7
8 #ifndef BABELTRACE_TRACE_IR_TRACE_INTERNAL_H
9 #define BABELTRACE_TRACE_IR_TRACE_INTERNAL_H
10
11 #include "lib/assert-pre.h"
12 #include <babeltrace2/trace-ir/trace.h>
13 #include <babeltrace2/trace-ir/field-class.h>
14 #include <babeltrace2/trace-ir/field.h>
15 #include "lib/object.h"
16 #include "lib/object-pool.h"
17 #include "common/macros.h"
18 #include <babeltrace2/value.h>
19 #include <babeltrace2/types.h>
20 #include <glib.h>
21 #include <stdbool.h>
22 #include <sys/types.h>
23 #include "common/uuid.h"
24
25 #include "attributes.h"
26 #include "clock-class.h"
27 #include "stream-class.h"
28 #include "trace-class.h"
29
30 struct bt_trace {
31 struct bt_object base;
32
33 /* Owned by this */
34 struct bt_value *user_attributes;
35
36 /* Owned by this */
37 struct bt_trace_class *class;
38
39 struct {
40 GString *str;
41
42 /* NULL or `str->str` above */
43 const char *value;
44 } name;
45
46 struct {
47 bt_uuid_t uuid;
48
49 /* NULL or `uuid` above */
50 bt_uuid value;
51 } uuid;
52
53 struct bt_value *environment;
54
55 /* Array of `struct bt_stream *` */
56 GPtrArray *streams;
57
58 /*
59 * Stream class (weak, owned by owned trace class) to number of
60 * instantiated streams, used to automatically assign stream IDs
61 * per stream class within this trace.
62 */
63 GHashTable *stream_classes_stream_count;
64
65 GArray *destruction_listeners;
66 bool frozen;
67 };
68
69 BT_HIDDEN
70 void _bt_trace_freeze(const struct bt_trace *trace);
71
72 #ifdef BT_DEV_MODE
73 # define bt_trace_freeze _bt_trace_freeze
74 #else
75 # define bt_trace_freeze(_trace)
76 #endif
77
78 BT_HIDDEN
79 void bt_trace_add_stream(struct bt_trace *trace, struct bt_stream *stream);
80
81 BT_HIDDEN
82 uint64_t bt_trace_get_automatic_stream_id(const struct bt_trace *trace,
83 const struct bt_stream_class *stream_class);
84
85 #endif /* BABELTRACE_TRACE_IR_TRACE_INTERNAL_H */
This page took 0.030821 seconds and 4 git commands to generate.