1 #ifndef BABELTRACE_CTF_WRITER_EVENT_H
2 #define BABELTRACE_CTF_WRITER_EVENT_H
5 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * The Common Trace Format (CTF) Specification is available at
28 * http://www.efficios.com/ctf
31 #include <babeltrace2/ctf-writer/object.h>
38 struct bt_ctf_event_class
;
41 struct bt_ctf_field_type
;
43 enum bt_ctf_event_class_log_level
{
44 /// Unknown, used for errors.
45 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN
= -1,
47 /// Unspecified log level.
48 BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED
= 255,
50 /// System is unusable.
51 BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY
= 0,
53 /// Action must be taken immediately.
54 BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT
= 1,
56 /// Critical conditions.
57 BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL
= 2,
60 BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR
= 3,
62 /// Warning conditions.
63 BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING
= 4,
65 /// Normal, but significant, condition.
66 BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE
= 5,
68 /// Informational message.
69 BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO
= 6,
71 /// Debug information with system-level scope (set of programs).
72 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM
= 7,
74 /// Debug information with program-level scope (set of processes).
75 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM
= 8,
77 /// Debug information with process-level scope (set of modules).
78 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS
= 9,
80 /// Debug information with module (executable/library) scope (set of units).
81 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE
= 10,
83 /// Debug information with compilation unit scope (set of functions).
84 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT
= 11,
86 /// Debug information with function-level scope.
87 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION
= 12,
89 /// Debug information with line-level scope (default log level).
90 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE
= 13,
92 /// Debug-level message.
93 BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG
= 14,
96 extern struct bt_ctf_event
*bt_ctf_event_create(
97 struct bt_ctf_event_class
*event_class
);
99 extern struct bt_ctf_field
*bt_ctf_event_get_payload(struct bt_ctf_event
*event
,
102 extern int bt_ctf_event_set_payload(struct bt_ctf_event
*event
,
103 const char *name
, struct bt_ctf_field
*field
);
105 extern struct bt_ctf_field
*bt_ctf_event_get_payload_field(
106 struct bt_ctf_event
*event
);
108 extern int bt_ctf_event_set_payload_field(struct bt_ctf_event
*event
,
109 struct bt_ctf_field
*field
);
111 extern int bt_ctf_event_set_context(struct bt_ctf_event
*event
,
112 struct bt_ctf_field
*field
);
114 extern struct bt_ctf_field
*bt_ctf_event_get_context(
115 struct bt_ctf_event
*event
);
117 extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event
*event
,
118 struct bt_ctf_field
*field
);
120 extern struct bt_ctf_field
*bt_ctf_event_get_stream_event_context(
121 struct bt_ctf_event
*event
);
123 extern int bt_ctf_event_set_header(struct bt_ctf_event
*event
,
124 struct bt_ctf_field
*field
);
126 extern struct bt_ctf_field
*bt_ctf_event_get_header(
127 struct bt_ctf_event
*event
);
129 extern struct bt_ctf_stream
*bt_ctf_event_get_stream(
130 struct bt_ctf_event
*event
);
132 extern struct bt_ctf_event_class
*bt_ctf_event_get_class(
133 struct bt_ctf_event
*event
);
135 /* Pre-2.0 CTF writer compatibility */
137 void bt_ctf_event_get(struct bt_ctf_event
*event
)
139 bt_ctf_object_get_ref(event
);
142 /* Pre-2.0 CTF writer compatibility */
144 void bt_ctf_event_put(struct bt_ctf_event
*event
)
146 bt_ctf_object_put_ref(event
);
149 extern struct bt_ctf_event_class
*bt_ctf_event_class_create(const char *name
);
151 extern struct bt_ctf_stream_class
*bt_ctf_event_class_get_stream_class(
152 struct bt_ctf_event_class
*event_class
);
154 extern const char *bt_ctf_event_class_get_name(
155 struct bt_ctf_event_class
*event_class
);
157 extern int64_t bt_ctf_event_class_get_id(
158 struct bt_ctf_event_class
*event_class
);
160 extern int bt_ctf_event_class_set_id(
161 struct bt_ctf_event_class
*event_class
, uint64_t id
);
163 extern enum bt_ctf_event_class_log_level
bt_ctf_event_class_get_log_level(
164 struct bt_ctf_event_class
*event_class
);
166 extern int bt_ctf_event_class_set_log_level(
167 struct bt_ctf_event_class
*event_class
,
168 enum bt_ctf_event_class_log_level log_level
);
170 extern const char *bt_ctf_event_class_get_emf_uri(
171 struct bt_ctf_event_class
*event_class
);
173 extern int bt_ctf_event_class_set_emf_uri(
174 struct bt_ctf_event_class
*event_class
,
175 const char *emf_uri
);
177 extern struct bt_ctf_field_type
*bt_ctf_event_class_get_context_field_type(
178 struct bt_ctf_event_class
*event_class
);
180 extern int bt_ctf_event_class_set_context_field_type(
181 struct bt_ctf_event_class
*event_class
,
182 struct bt_ctf_field_type
*context_type
);
184 extern struct bt_ctf_field_type
*bt_ctf_event_class_get_payload_field_type(
185 struct bt_ctf_event_class
*event_class
);
187 extern int bt_ctf_event_class_set_payload_field_type(
188 struct bt_ctf_event_class
*event_class
,
189 struct bt_ctf_field_type
*payload_type
);
191 extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class
*event_class
,
192 struct bt_ctf_field_type
*field_type
,
195 extern struct bt_ctf_field_type
*bt_ctf_event_class_get_field_by_name(
196 struct bt_ctf_event_class
*event_class
, const char *name
);
198 /* Pre-2.0 CTF writer compatibility */
200 void bt_ctf_event_class_get(struct bt_ctf_event_class
*event_class
)
202 bt_ctf_object_get_ref(event_class
);
205 /* Pre-2.0 CTF writer compatibility */
207 void bt_ctf_event_class_put(struct bt_ctf_event_class
*event_class
)
209 bt_ctf_object_put_ref(event_class
);
216 #endif /* BABELTRACE_CTF_WRITER_EVENT_H */