2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
7 #ifndef BABELTRACE2_CTF_WRITER_EVENT_H
8 #define BABELTRACE2_CTF_WRITER_EVENT_H
10 #include <babeltrace2-ctf-writer/object.h>
17 struct bt_ctf_event_class
;
20 struct bt_ctf_field_type
;
22 enum bt_ctf_event_class_log_level
{
23 /// Unknown, used for errors.
24 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN
= -1,
26 /// Unspecified log level.
27 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED
= 255,
29 /// System is unusable.
30 BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY
= 0,
32 /// Action must be taken immediately.
33 BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT
= 1,
35 /// Critical conditions.
36 BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL
= 2,
39 BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR
= 3,
41 /// Warning conditions.
42 BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING
= 4,
44 /// Normal, but significant, condition.
45 BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE
= 5,
47 /// Informational message.
48 BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO
= 6,
50 /// Debug information with system-level scope (set of programs).
51 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM
= 7,
53 /// Debug information with program-level scope (set of processes).
54 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM
= 8,
56 /// Debug information with process-level scope (set of modules).
57 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS
= 9,
59 /// Debug information with module (executable/library) scope (set of units).
60 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE
= 10,
62 /// Debug information with compilation unit scope (set of functions).
63 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT
= 11,
65 /// Debug information with function-level scope.
66 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION
= 12,
68 /// Debug information with line-level scope (default log level).
69 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE
= 13,
71 /// Debug-level message.
72 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG
= 14,
75 extern struct bt_ctf_event
*bt_ctf_event_create(
76 struct bt_ctf_event_class
*event_class
);
78 extern struct bt_ctf_field
*bt_ctf_event_get_payload(struct bt_ctf_event
*event
,
81 extern int bt_ctf_event_set_payload(struct bt_ctf_event
*event
,
82 const char *name
, struct bt_ctf_field
*field
);
84 extern struct bt_ctf_field
*bt_ctf_event_get_payload_field(
85 struct bt_ctf_event
*event
);
87 extern int bt_ctf_event_set_payload_field(struct bt_ctf_event
*event
,
88 struct bt_ctf_field
*field
);
90 extern int bt_ctf_event_set_context(struct bt_ctf_event
*event
,
91 struct bt_ctf_field
*field
);
93 extern struct bt_ctf_field
*bt_ctf_event_get_context(
94 struct bt_ctf_event
*event
);
96 extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event
*event
,
97 struct bt_ctf_field
*field
);
99 extern struct bt_ctf_field
*bt_ctf_event_get_stream_event_context(
100 struct bt_ctf_event
*event
);
102 extern int bt_ctf_event_set_header(struct bt_ctf_event
*event
,
103 struct bt_ctf_field
*field
);
105 extern struct bt_ctf_field
*bt_ctf_event_get_header(
106 struct bt_ctf_event
*event
);
108 extern struct bt_ctf_stream
*bt_ctf_event_get_stream(
109 struct bt_ctf_event
*event
);
111 extern struct bt_ctf_event_class
*bt_ctf_event_get_class(
112 struct bt_ctf_event
*event
);
114 /* Pre-2.0 CTF writer compatibility */
116 void bt_ctf_event_get(struct bt_ctf_event
*event
)
118 bt_ctf_object_get_ref(event
);
121 /* Pre-2.0 CTF writer compatibility */
123 void bt_ctf_event_put(struct bt_ctf_event
*event
)
125 bt_ctf_object_put_ref(event
);
128 extern struct bt_ctf_event_class
*bt_ctf_event_class_create(const char *name
);
130 extern struct bt_ctf_stream_class
*bt_ctf_event_class_get_stream_class(
131 struct bt_ctf_event_class
*event_class
);
133 extern const char *bt_ctf_event_class_get_name(
134 struct bt_ctf_event_class
*event_class
);
136 extern int64_t bt_ctf_event_class_get_id(
137 struct bt_ctf_event_class
*event_class
);
139 extern int bt_ctf_event_class_set_id(
140 struct bt_ctf_event_class
*event_class
, uint64_t id
);
142 extern enum bt_ctf_event_class_log_level
bt_ctf_event_class_get_log_level(
143 struct bt_ctf_event_class
*event_class
);
145 extern int bt_ctf_event_class_set_log_level(
146 struct bt_ctf_event_class
*event_class
,
147 enum bt_ctf_event_class_log_level log_level
);
149 extern const char *bt_ctf_event_class_get_emf_uri(
150 struct bt_ctf_event_class
*event_class
);
152 extern int bt_ctf_event_class_set_emf_uri(
153 struct bt_ctf_event_class
*event_class
,
154 const char *emf_uri
);
156 extern struct bt_ctf_field_type
*bt_ctf_event_class_get_context_field_type(
157 struct bt_ctf_event_class
*event_class
);
159 extern int bt_ctf_event_class_set_context_field_type(
160 struct bt_ctf_event_class
*event_class
,
161 struct bt_ctf_field_type
*context_type
);
163 extern struct bt_ctf_field_type
*bt_ctf_event_class_get_payload_field_type(
164 struct bt_ctf_event_class
*event_class
);
166 extern int64_t bt_ctf_event_class_get_payload_type_field_count(
167 struct bt_ctf_event_class
*event_class
);
169 extern int bt_ctf_event_class_get_payload_type_field_by_index(
170 struct bt_ctf_event_class
*event_class
,
171 const char **field_name
, struct bt_ctf_field_type
**field_type
,
174 extern struct bt_ctf_field_type
*
175 bt_ctf_event_class_get_payload_type_field_type_by_name(
176 struct bt_ctf_event_class
*event_class
, const char *name
);
178 extern int bt_ctf_event_class_set_payload_field_type(
179 struct bt_ctf_event_class
*event_class
,
180 struct bt_ctf_field_type
*payload_type
);
182 extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class
*event_class
,
183 struct bt_ctf_field_type
*field_type
,
186 extern struct bt_ctf_field_type
*bt_ctf_event_class_get_field_by_name(
187 struct bt_ctf_event_class
*event_class
, const char *name
);
189 /* Pre-2.0 CTF writer compatibility */
191 void bt_ctf_event_class_get(struct bt_ctf_event_class
*event_class
)
193 bt_ctf_object_get_ref(event_class
);
196 /* Pre-2.0 CTF writer compatibility */
198 void bt_ctf_event_class_put(struct bt_ctf_event_class
*event_class
)
200 bt_ctf_object_put_ref(event_class
);
207 #endif /* BABELTRACE2_CTF_WRITER_EVENT_H */