Commit | Line | Data |
---|---|---|
8c18d80b PP |
1 | #ifndef BABELTRACE_CTF_WRITER_EVENT_H |
2 | #define BABELTRACE_CTF_WRITER_EVENT_H | |
3 | ||
46bd0f2b JG |
4 | /* |
5 | * BabelTrace - CTF Writer: Event | |
6 | * | |
de9dd397 | 7 | * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
46bd0f2b 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 | * The Common Trace Format (CTF) Specification is available at | |
30 | * http://www.efficios.com/ctf | |
31 | */ | |
32 | ||
8deee039 | 33 | #include <babeltrace/ref.h> |
272df73e | 34 | #include <babeltrace/ctf-ir/event-class.h> |
adc315b8 | 35 | #include <babeltrace/ctf-ir/event.h> |
8c18d80b PP |
36 | |
37 | #ifdef __cplusplus | |
38 | extern "C" { | |
39 | #endif | |
40 | ||
8deee039 PP |
41 | struct bt_ctf_event; |
42 | struct bt_ctf_event_class; | |
43 | struct bt_ctf_stream; | |
44 | struct bt_ctf_field; | |
45 | struct bt_ctf_field_type; | |
8c18d80b | 46 | |
8deee039 PP |
47 | enum bt_ctf_event_class_log_level { |
48 | /// Unknown, used for errors. | |
49 | BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN, | |
50 | ||
51 | /// Unspecified log level. | |
52 | BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED, | |
53 | ||
54 | /// System is unusable. | |
55 | BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY, | |
56 | ||
57 | /// Action must be taken immediately. | |
58 | BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = BT_EVENT_CLASS_LOG_LEVEL_ALERT, | |
59 | ||
60 | /// Critical conditions. | |
61 | BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = BT_EVENT_CLASS_LOG_LEVEL_CRITICAL, | |
62 | ||
63 | /// Error conditions. | |
64 | BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = BT_EVENT_CLASS_LOG_LEVEL_ERROR, | |
65 | ||
66 | /// Warning conditions. | |
67 | BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = BT_EVENT_CLASS_LOG_LEVEL_WARNING, | |
68 | ||
69 | /// Normal, but significant, condition. | |
70 | BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = BT_EVENT_CLASS_LOG_LEVEL_NOTICE, | |
71 | ||
72 | /// Informational message. | |
73 | BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = BT_EVENT_CLASS_LOG_LEVEL_INFO, | |
74 | ||
75 | /// Debug information with system-level scope (set of programs). | |
76 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM, | |
77 | ||
78 | /// Debug information with program-level scope (set of processes). | |
79 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM, | |
80 | ||
81 | /// Debug information with process-level scope (set of modules). | |
82 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS, | |
83 | ||
84 | /// Debug information with module (executable/library) scope (set of units). | |
85 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE, | |
86 | ||
87 | /// Debug information with compilation unit scope (set of functions). | |
88 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT, | |
89 | ||
90 | /// Debug information with function-level scope. | |
91 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION, | |
92 | ||
93 | /// Debug information with line-level scope (default log level). | |
94 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE, | |
95 | ||
96 | /// Debug-level message. | |
97 | BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = BT_EVENT_CLASS_LOG_LEVEL_DEBUG, | |
98 | }; | |
99 | ||
100 | extern struct bt_ctf_event *bt_ctf_event_create( | |
101 | struct bt_ctf_event_class *event_class); | |
102 | ||
103 | extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event, | |
104 | const char *name); | |
105 | ||
106 | extern int bt_ctf_event_set_payload(struct bt_ctf_event *event, | |
107 | const char *name, struct bt_ctf_field *field); | |
108 | ||
109 | extern struct bt_ctf_field *bt_ctf_event_get_payload_field( | |
110 | struct bt_ctf_event *event); | |
111 | ||
112 | extern int bt_ctf_event_set_payload_field(struct bt_ctf_event *event, | |
113 | struct bt_ctf_field *field); | |
114 | ||
115 | extern int bt_ctf_event_set_context(struct bt_ctf_event *event, | |
116 | struct bt_ctf_field *field); | |
117 | ||
118 | extern struct bt_ctf_field *bt_ctf_event_get_context( | |
119 | struct bt_ctf_event *event); | |
120 | ||
121 | extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, | |
122 | struct bt_ctf_field *field); | |
123 | ||
124 | extern struct bt_ctf_field *bt_ctf_event_get_stream_event_context( | |
125 | struct bt_ctf_event *event); | |
126 | ||
127 | extern int bt_ctf_event_set_header(struct bt_ctf_event *event, | |
128 | struct bt_ctf_field *field); | |
129 | ||
130 | extern struct bt_ctf_field *bt_ctf_event_get_header( | |
131 | struct bt_ctf_event *event); | |
132 | ||
133 | extern struct bt_ctf_stream *bt_ctf_event_get_stream( | |
134 | struct bt_ctf_event *event); | |
135 | ||
136 | extern struct bt_ctf_event_class *bt_ctf_event_get_class( | |
137 | struct bt_ctf_event *event); | |
138 | ||
139 | /* Pre-2.0 CTF writer compatibility */ | |
140 | static inline | |
141 | void bt_ctf_event_get(struct bt_ctf_event *event) | |
142 | { | |
143 | bt_get(event); | |
144 | } | |
145 | ||
146 | /* Pre-2.0 CTF writer compatibility */ | |
147 | static inline | |
148 | void bt_ctf_event_put(struct bt_ctf_event *event) | |
149 | { | |
150 | bt_put(event); | |
151 | } | |
152 | ||
153 | extern struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name); | |
154 | ||
155 | extern struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class( | |
156 | struct bt_ctf_event_class *event_class); | |
157 | ||
158 | extern const char *bt_ctf_event_class_get_name( | |
159 | struct bt_ctf_event_class *event_class); | |
160 | ||
161 | extern int64_t bt_ctf_event_class_get_id( | |
162 | struct bt_ctf_event_class *event_class); | |
163 | ||
164 | extern int bt_ctf_event_class_set_id( | |
165 | struct bt_ctf_event_class *event_class, uint64_t id); | |
166 | ||
167 | extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level( | |
168 | struct bt_ctf_event_class *event_class); | |
169 | ||
170 | extern int bt_ctf_event_class_set_log_level( | |
171 | struct bt_ctf_event_class *event_class, | |
172 | enum bt_ctf_event_class_log_level log_level); | |
173 | ||
174 | extern const char *bt_ctf_event_class_get_emf_uri( | |
175 | struct bt_ctf_event_class *event_class); | |
176 | ||
177 | extern int bt_ctf_event_class_set_emf_uri( | |
178 | struct bt_ctf_event_class *event_class, | |
179 | const char *emf_uri); | |
180 | ||
181 | extern struct bt_ctf_field_type *bt_ctf_event_class_get_context_field_type( | |
182 | struct bt_ctf_event_class *event_class); | |
183 | ||
184 | extern int bt_ctf_event_class_set_context_field_type( | |
185 | struct bt_ctf_event_class *event_class, | |
186 | struct bt_ctf_field_type *context_type); | |
187 | ||
188 | extern struct bt_ctf_field_type *bt_ctf_event_class_get_payload_field_type( | |
189 | struct bt_ctf_event_class *event_class); | |
190 | ||
191 | extern int bt_ctf_event_class_set_payload_field_type( | |
192 | struct bt_ctf_event_class *event_class, | |
193 | struct bt_ctf_field_type *payload_type); | |
194 | ||
195 | extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, | |
196 | struct bt_ctf_field_type *field_type, | |
197 | const char *name); | |
198 | ||
199 | extern struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name( | |
200 | struct bt_ctf_event_class *event_class, const char *name); | |
201 | ||
202 | /* Pre-2.0 CTF writer compatibility */ | |
203 | static inline | |
204 | void bt_ctf_event_class_get(struct bt_ctf_event_class *event_class) | |
205 | { | |
206 | bt_get(event_class); | |
207 | } | |
208 | ||
209 | /* Pre-2.0 CTF writer compatibility */ | |
210 | static inline | |
211 | void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class) | |
212 | { | |
213 | bt_put(event_class); | |
214 | } | |
8c18d80b PP |
215 | |
216 | #ifdef __cplusplus | |
217 | } | |
218 | #endif | |
219 | ||
220 | #endif /* BABELTRACE_CTF_WRITER_EVENT_H */ |