Commit | Line | Data |
---|---|---|
c7e35b03 JR |
1 | /* |
2 | * Copyright (C) 2014 - Jonathan Rajotte <jonathan.r.julien@gmail.com> | |
3 | * - Olivier Cotte <olivier.cotte@polymtl.ca> | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU General Public License, version 2 only, as | |
7 | * published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License along with | |
15 | * this program; if not, write to the Free Software Foundation, Inc., 51 | |
16 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 | */ | |
18 | ||
19 | #ifndef _MI_LTTNG_H | |
20 | #define _MI_LTTNG_H | |
21 | ||
22 | #include <stdint.h> | |
23 | ||
24 | #include <common/error.h> | |
25 | #include <common/macros.h> | |
26 | #include <common/config/config.h> | |
27 | #include <lttng/lttng.h> | |
28 | ||
50534d6f JRJ |
29 | /* Don't want to reference snapshot-internal.h here */ |
30 | struct lttng_snapshot_output; | |
31 | ||
c7e35b03 JR |
32 | /* Instance of a machine interface writer. */ |
33 | struct mi_writer { | |
34 | struct config_writer *writer; | |
35 | enum lttng_mi_output_type type; | |
36 | }; | |
37 | ||
38 | /* | |
39 | * Version information for the machine interface. | |
40 | */ | |
41 | struct mi_lttng_version { | |
42 | char version[NAME_MAX]; /* Version number of package */ | |
43 | uint32_t version_major; /* LTTng-Tools major version number */ | |
44 | uint32_t version_minor; /* LTTng-Tools minor version number */ | |
45 | uint32_t version_patchlevel; /* LTTng-Tools patchlevel version number */ | |
314d5222 | 46 | char version_commit[NAME_MAX]; /* Commit hash of the current version */ |
c7e35b03 JR |
47 | char version_name[NAME_MAX]; |
48 | char package_url[NAME_MAX]; /* Define to the home page for this package. */ | |
49 | }; | |
50 | ||
51 | /* Strings related to command */ | |
52 | const char * const mi_lttng_element_command; | |
50534d6f | 53 | const char * const mi_lttng_element_command_action; |
f4a088f7 JRJ |
54 | const char * const mi_lttng_element_command_add_context; |
55 | const char * const mi_lttng_element_command_calibrate; | |
37d03ff7 | 56 | const char * const mi_lttng_element_command_create; |
65f25c66 | 57 | const char * const mi_lttng_element_command_destroy; |
f4a088f7 JRJ |
58 | const char * const mi_lttng_element_command_disable_channel; |
59 | const char * const mi_lttng_element_command_disable_event; | |
acc09215 | 60 | const char * const mi_lttng_element_command_enable_channels; |
f4a088f7 JRJ |
61 | const char * const mi_lttng_element_command_enable_event; |
62 | const char * const mi_lttng_element_command_list; | |
63 | const char * const mi_lttng_element_command_load; | |
64 | const char * const mi_lttng_element_command_name; | |
65 | const char * const mi_lttng_element_command_output; | |
66 | const char * const mi_lttng_element_command_save; | |
ce91cd0b | 67 | const char * const mi_lttng_element_command_set_session; |
50534d6f | 68 | const char * const mi_lttng_element_command_snapshot; |
f4a088f7 JRJ |
69 | const char * const mi_lttng_element_command_snapshot_add; |
70 | const char * const mi_lttng_element_command_snapshot_del; | |
71 | const char * const mi_lttng_element_command_snapshot_list; | |
72 | const char * const mi_lttng_element_command_snapshot_record; | |
73 | const char * const mi_lttng_element_command_start; | |
74 | const char * const mi_lttng_element_command_stop; | |
1734c658 | 75 | const char * const mi_lttng_element_command_success; |
f4a088f7 | 76 | const char * const mi_lttng_element_command_version; |
c7e35b03 | 77 | |
1734c658 | 78 | /* Strings related to version command */ |
c7e35b03 | 79 | const char * const mi_lttng_element_version; |
f4a088f7 JRJ |
80 | const char * const mi_lttng_element_version_commit; |
81 | const char * const mi_lttng_element_version_description; | |
82 | const char * const mi_lttng_element_version_license; | |
c7e35b03 JR |
83 | const char * const mi_lttng_element_version_major; |
84 | const char * const mi_lttng_element_version_minor; | |
c7e35b03 | 85 | const char * const mi_lttng_element_version_patch_level; |
f4a088f7 JRJ |
86 | const char * const mi_lttng_element_version_str; |
87 | const char * const mi_lttng_element_version_web; | |
c7e35b03 | 88 | |
5e18ec73 JR |
89 | /* String related to a lttng_event_field */ |
90 | const char * const mi_lttng_element_event_field; | |
91 | const char * const mi_lttng_element_event_fields; | |
92 | ||
89b72577 JRJ |
93 | /* String related to lttng_event_context */ |
94 | const char * const mi_lttng_context_type_perf_counter; | |
95 | const char * const mi_lttng_context_type_perf_cpu_counter; | |
96 | const char * const mi_lttng_context_type_perf_thread_counter; | |
97 | ||
98 | /* String related to lttng_event_perf_counter_ctx */ | |
99 | const char * const mi_lttng_element_perf_counter_context; | |
100 | ||
5e18ec73 JR |
101 | /* Strings related to pid */ |
102 | const char * const mi_lttng_element_pids; | |
103 | const char * const mi_lttng_element_pid; | |
104 | const char * const mi_lttng_element_pid_id; | |
105 | ||
1734c658 JRJ |
106 | /* Strings related to save command */ |
107 | const char * const mi_lttng_element_save; | |
108 | ||
109 | /* Strings related to load command */ | |
110 | const char * const mi_lttng_element_load; | |
111 | ||
5e18ec73 | 112 | /* General element of mi_lttng */ |
f4a088f7 JRJ |
113 | const char * const mi_lttng_element_empty; |
114 | const char * const mi_lttng_element_id; | |
115 | const char * const mi_lttng_element_nowrite; | |
116 | const char * const mi_lttng_element_success; | |
5e18ec73 JR |
117 | const char * const mi_lttng_element_type_enum; |
118 | const char * const mi_lttng_element_type_float; | |
f4a088f7 JRJ |
119 | const char * const mi_lttng_element_type_integer; |
120 | const char * const mi_lttng_element_type_other; | |
5e18ec73 | 121 | const char * const mi_lttng_element_type_string; |
5e18ec73 JR |
122 | |
123 | /* String related to loglevel */ | |
124 | const char * const mi_lttng_loglevel_str_alert; | |
125 | const char * const mi_lttng_loglevel_str_crit; | |
126 | const char * const mi_lttng_loglevel_str_debug; | |
127 | const char * const mi_lttng_loglevel_str_debug_function; | |
128 | const char * const mi_lttng_loglevel_str_debug_line; | |
129 | const char * const mi_lttng_loglevel_str_debug_module; | |
130 | const char * const mi_lttng_loglevel_str_debug_process; | |
131 | const char * const mi_lttng_loglevel_str_debug_program; | |
132 | const char * const mi_lttng_loglevel_str_debug_system; | |
133 | const char * const mi_lttng_loglevel_str_debug_unit; | |
134 | const char * const mi_lttng_loglevel_str_emerg; | |
135 | const char * const mi_lttng_loglevel_str_err; | |
136 | const char * const mi_lttng_loglevel_str_info; | |
137 | const char * const mi_lttng_loglevel_str_notice; | |
138 | const char * const mi_lttng_loglevel_str_unknown; | |
139 | const char * const mi_lttng_loglevel_str_warning; | |
140 | ||
136f2f81 JRJ |
141 | /* String related to loglevel JUL */ |
142 | const char * const mi_lttng_loglevel_str_jul_all; | |
143 | const char * const mi_lttng_loglevel_str_jul_config; | |
144 | const char * const mi_lttng_loglevel_str_jul_fine; | |
145 | const char * const mi_lttng_loglevel_str_jul_finer; | |
146 | const char * const mi_lttng_loglevel_str_jul_finest; | |
147 | const char * const mi_lttng_loglevel_str_jul_info; | |
148 | const char * const mi_lttng_loglevel_str_jul_off; | |
149 | const char * const mi_lttng_loglevel_str_jul_severe; | |
150 | const char * const mi_lttng_loglevel_str_jul_warning; | |
151 | ||
1734c658 | 152 | /* String related to loglevel type */ |
5e18ec73 JR |
153 | const char * const mi_lttng_loglevel_type_all; |
154 | const char * const mi_lttng_loglevel_type_range; | |
155 | const char * const mi_lttng_loglevel_type_single; | |
156 | const char * const mi_lttng_loglevel_type_unknown; | |
157 | ||
7e66b1b0 JRJ |
158 | /* Sting related to lttng_calibrate */ |
159 | const char * const mi_lttng_element_calibrate; | |
160 | const char * const mi_lttng_element_calibrate_function; | |
161 | ||
136f2f81 | 162 | /* String related to a lttng_snapshot */ |
50534d6f | 163 | const char * const mi_lttng_element_snapshot_ctrl_url; |
f4a088f7 | 164 | const char * const mi_lttng_element_snapshot_data_url; |
50534d6f | 165 | const char * const mi_lttng_element_snapshot_max_size; |
f4a088f7 JRJ |
166 | const char * const mi_lttng_element_snapshot_n_ptr; |
167 | const char * const mi_lttng_element_snapshot_session_name; | |
168 | const char * const mi_lttng_element_snapshots; | |
50534d6f | 169 | |
5e18ec73 JR |
170 | /* Utility string function */ |
171 | const char *mi_lttng_loglevel_string(int value); | |
172 | const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value); | |
173 | const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value); | |
174 | const char *mi_lttng_domaintype_string(enum lttng_domain_type value); | |
175 | const char *mi_lttng_buffertype_string(enum lttng_buffer_type value); | |
7e66b1b0 | 176 | const char *mi_lttng_calibratetype_string(enum lttng_calibrate_type val); |
5e18ec73 | 177 | |
c7e35b03 JR |
178 | /* |
179 | * Create an instance of a machine interface writer. | |
180 | * | |
181 | * fd_output File to which the XML content must be written. The file will be | |
182 | * closed once the mi_writer has been destroyed. | |
183 | * | |
184 | * Returns an instance of a machine interface writer on success, NULL on | |
185 | * error. | |
186 | */ | |
187 | struct mi_writer *mi_lttng_writer_create(int fd_output, int mi_output_type); | |
188 | ||
189 | /* | |
190 | * Destroy an instance of a machine interface writer. | |
191 | * | |
192 | * writer An instance of a machine interface writer. | |
193 | * | |
194 | * Returns zero if the XML document could be closed cleanly. Negative values | |
195 | * indicate an error. | |
196 | */ | |
197 | int mi_lttng_writer_destroy(struct mi_writer *writer); | |
198 | ||
199 | /* | |
200 | * Open a command tag and add it's name node. | |
201 | * | |
202 | * writer An instance of a machine interface writer. | |
c7e35b03 JR |
203 | * command The command name. |
204 | * | |
205 | * Returns zero if the XML document could be closed cleanly. | |
206 | * Negative values indicate an error. | |
207 | */ | |
208 | int mi_lttng_writer_command_open(struct mi_writer *writer, const char *command); | |
209 | ||
210 | /* | |
211 | * Close a command tag. | |
212 | * | |
213 | * writer An instance of a machine interface writer. | |
214 | * | |
215 | * Returns zero if the XML document could be closed cleanly. | |
216 | * Negative values indicate an error. | |
217 | */ | |
218 | int mi_lttng_writer_command_close(struct mi_writer *writer); | |
219 | ||
220 | /* | |
221 | * Open an element tag. | |
222 | * | |
223 | * writer An instance of a machine interface writer. | |
c7e35b03 JR |
224 | * element_name Element tag name. |
225 | * | |
226 | * Returns zero if the XML document could be closed cleanly. | |
227 | * Negative values indicate an error. | |
228 | */ | |
229 | int mi_lttng_writer_open_element(struct mi_writer *writer, | |
230 | const char *element_name); | |
231 | ||
232 | /* | |
233 | * Close the current element tag. | |
234 | * | |
235 | * writer An instance of a machine interface writer. | |
236 | * | |
237 | * Returns zero if the XML document could be closed cleanly. | |
238 | * Negative values indicate an error. | |
239 | */ | |
240 | int mi_lttng_writer_close_element(struct mi_writer *writer); | |
241 | ||
242 | /* | |
5e18ec73 | 243 | * Close multiple element. |
c7e35b03 JR |
244 | * |
245 | * writer An instance of a machine interface writer. | |
5e18ec73 | 246 | * nb_element Number of elements. |
c7e35b03 | 247 | * |
5e18ec73 JR |
248 | * Returns zero if the XML document could be closed cleanly. |
249 | * Negative values indicate an error. | |
250 | */ | |
251 | int mi_lttng_close_multi_element(struct mi_writer *writer, | |
252 | unsigned int nb_element); | |
253 | ||
254 | /* | |
255 | * Write an element of type unsigned int. | |
c7e35b03 | 256 | * |
5e18ec73 JR |
257 | * writer An instance of a machine interface writer. |
258 | * element_name Element name. | |
c7e35b03 JR |
259 | * value Unsigned int value of the element |
260 | * | |
261 | * Returns zero if the element's value could be written. | |
262 | * Negative values indicate an error. | |
263 | */ | |
264 | int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer, | |
265 | const char *element_name, uint64_t value); | |
266 | ||
267 | /* | |
268 | * Write an element of type signed int. | |
269 | * | |
270 | * writer An instance of a machine interface writer. | |
c7e35b03 | 271 | * element_name Element name. |
5e18ec73 | 272 | * value Signed int value of the element. |
c7e35b03 JR |
273 | * |
274 | * Returns zero if the element's value could be written. | |
275 | * Negative values indicate an error. | |
276 | */ | |
277 | int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer, | |
278 | const char *element_name, int64_t value); | |
279 | ||
280 | /* | |
281 | * Write an element of type boolean. | |
282 | * | |
283 | * writer An instance of a machine interface writer. | |
c7e35b03 | 284 | * element_name Element name. |
5e18ec73 | 285 | * value Boolean value of the element. |
c7e35b03 JR |
286 | * |
287 | * Returns zero if the element's value could be written. | |
288 | * Negative values indicate an error. | |
289 | */ | |
290 | int mi_lttng_writer_write_element_bool(struct mi_writer *writer, | |
291 | const char *element_name, int value); | |
292 | ||
293 | /* | |
294 | * Write an element of type string. | |
295 | * | |
296 | * writer An instance of a machine interface writer. | |
c7e35b03 | 297 | * element_name Element name. |
5e18ec73 | 298 | * value String value of the element. |
c7e35b03 JR |
299 | * |
300 | * Returns zero if the element's value could be written. | |
301 | * Negative values indicate an error. | |
302 | */ | |
303 | int mi_lttng_writer_write_element_string(struct mi_writer *writer, | |
304 | const char *element_name, const char *value); | |
305 | ||
306 | /* | |
307 | * Machine interface of struct version. | |
308 | * | |
309 | * writer An instance of a machine interface writer. | |
c7e35b03 | 310 | * version Version struct. |
c7e35b03 | 311 | * lttng_description String value of the version description. |
c7e35b03 JR |
312 | * lttng_license String value of the version license. |
313 | * | |
314 | * Returns zero if the element's value could be written. | |
315 | * Negative values indicate an error. | |
316 | */ | |
317 | int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version *version, | |
318 | const char *lttng_description, const char *lttng_license); | |
319 | ||
320 | /* | |
5e18ec73 | 321 | * Machine interface: open a sessions element. |
c7e35b03 | 322 | * |
5e18ec73 | 323 | * writer An instance of a machine interface writer. |
c7e35b03 | 324 | * |
5e18ec73 JR |
325 | * Returns zero if the element's value could be written. |
326 | * Negative values indicate an error. | |
327 | */ | |
328 | int mi_lttng_sessions_open(struct mi_writer *writer); | |
329 | ||
330 | /* | |
331 | * Machine interface of struct session. | |
c7e35b03 | 332 | * |
5e18ec73 JR |
333 | * writer An instance of a machine interface writer. |
334 | * session An instance of a session. | |
335 | * is_open Defines whether or not the session element shall be closed. | |
336 | * This should be used carefully and the client | |
337 | * must close the session element. | |
136f2f81 | 338 | * Use case: nested additional information on a session |
c7e35b03 | 339 | * ex: domain,channel event. |
c7e35b03 JR |
340 | * |
341 | * Returns zero if the element's value could be written. | |
342 | * Negative values indicate an error. | |
343 | */ | |
344 | int mi_lttng_session(struct mi_writer *writer, | |
5e18ec73 JR |
345 | struct lttng_session *session, int is_open); |
346 | ||
347 | /* | |
348 | * Machine interface: open a domains element. | |
349 | * | |
350 | * writer An instance of a machine interface writer. | |
351 | * | |
352 | * Returns zero if the element's value could be written. | |
353 | * Negative values indicate an error. | |
354 | */ | |
355 | int mi_lttng_domains_open(struct mi_writer *writer); | |
356 | ||
357 | /* | |
358 | * Machine interface of struct domain. | |
359 | * | |
360 | * writer An instance of a machine interface writer. | |
361 | * domain An instance of a domain. | |
362 | * | |
363 | * is_open Defines whether or not the session element shall be closed. | |
364 | * This should be used carefully and the client | |
365 | * must close the domain element. | |
366 | * Use case: nested addition information on a domain | |
367 | * ex: channel event. | |
368 | * | |
369 | * Returns zero if the element's value could be written. | |
370 | * Negative values indicate an error. | |
371 | */ | |
372 | int mi_lttng_domain(struct mi_writer *writer, | |
373 | struct lttng_domain *domain, int is_open); | |
374 | ||
375 | /* | |
376 | * Machine interface: open a channels element. | |
377 | * | |
378 | * writer An instance of a machine interface writer. | |
379 | * | |
380 | * Returns zero if the element's value could be written. | |
381 | * Negative values indicate an error. | |
382 | */ | |
383 | int mi_lttng_channels_open(struct mi_writer *writer); | |
384 | ||
385 | /* | |
386 | * Machine interface of struct channel. | |
387 | * | |
388 | * writer An instance of a machine interface writer. | |
389 | * channel An instance of a channel. | |
390 | * | |
391 | * is_open Defines whether or not the session element shall be closed. | |
392 | * This should be used carefully and the client | |
393 | * must close the channel element. | |
394 | * Use case: nested addition information on a channel. | |
395 | * ex: channel event. | |
396 | * | |
397 | * Returns zero if the element's value could be written. | |
398 | * Negative values indicate an error. | |
399 | */ | |
400 | int mi_lttng_channel(struct mi_writer *writer, | |
401 | struct lttng_channel *channel, int is_open); | |
402 | ||
403 | /* | |
404 | * Machine interface of struct channel_attr. | |
405 | * | |
406 | * writer An instance of a machine interface writer. | |
407 | * attr An instance of a channel_attr struct. | |
408 | * | |
409 | * Returns zero if the element's value could be written. | |
410 | * Negative values indicate an error. | |
411 | */ | |
412 | int mi_lttng_channel_attr(struct mi_writer *writer, | |
413 | struct lttng_channel_attr *attr); | |
414 | ||
415 | /* | |
416 | * Machine interface for event common attributes. | |
417 | * | |
418 | * writer An instance of a mi writer. | |
419 | * event single trace event. | |
420 | * | |
421 | * The common attribute are: | |
422 | * - mi event element | |
423 | * - event name | |
424 | * - event type | |
425 | * - enabled tag | |
426 | * - event filter | |
427 | * | |
428 | * Returns zero if the element's value could be written. | |
429 | * Negative values indicate an error. | |
430 | */ | |
431 | int mi_lttng_event_common_attributes(struct mi_writer *writer, | |
432 | struct lttng_event *event); | |
433 | ||
434 | /* | |
435 | * Machine interface for kernel tracepoint event with a loglevel. | |
436 | * | |
437 | * writer An instance of a mi writer. | |
438 | * event single trace event. | |
439 | * | |
440 | * Returns zero if the element's value could be written. | |
441 | * Negative values indicate an error. | |
442 | */ | |
443 | int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer, | |
444 | struct lttng_event *event); | |
445 | ||
446 | /* | |
447 | * Machine interface for kernel tracepoint event with no loglevel. | |
448 | * | |
449 | * writer An instance of a mi writer. | |
450 | * event single trace event. | |
451 | * | |
452 | * Returns zero if the element's value could be written. | |
453 | * Negative values indicate an error. | |
454 | */ | |
455 | int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer, | |
456 | struct lttng_event *event); | |
457 | ||
458 | /* | |
459 | * Machine interface for kernel function and probe event. | |
460 | * | |
461 | * writer An instance of a mi writer. | |
462 | * event single trace event. | |
463 | * | |
464 | * Returns zero if the element's value could be written. | |
465 | * Negative values indicate an error. | |
466 | */ | |
467 | int mi_lttng_event_function_probe(struct mi_writer *writer, | |
468 | struct lttng_event *event); | |
469 | ||
470 | /* | |
471 | * Machine interface for kernel function entry event. | |
472 | * | |
473 | * writer An instance of a mi writer. | |
474 | * event single trace event. | |
475 | * | |
476 | * Returns zero if the element's value could be written. | |
477 | * Negative values indicate an error. | |
478 | */ | |
479 | int mi_lttng_event_function_entry(struct mi_writer *writer, | |
480 | struct lttng_event *event); | |
481 | ||
482 | /* | |
483 | * Machine interface: open an events element. | |
484 | * | |
485 | * writer An instance of a machine interface writer. | |
486 | * | |
487 | * Returns zero if the element's value could be written. | |
488 | * Negative values indicate an error. | |
489 | */ | |
490 | int mi_lttng_events_open(struct mi_writer *writer); | |
491 | ||
492 | /* | |
493 | * Machine interface for printing an event. | |
494 | * The trace event type currently supported are: | |
495 | * TRACEPOINT, | |
496 | * PROBE, | |
497 | * FUNCTION, | |
498 | * FUNCTION_ENTRY, | |
499 | * SYSCALL | |
500 | * | |
501 | * writer An instance of a mi writer. | |
502 | * event single trace event. | |
503 | * is_open Defines whether or not the session element shall be closed. | |
504 | * This should be used carefully and the client | |
505 | * must close the event element. | |
506 | * Use case: nested additional information | |
507 | * | |
508 | * Returns zero if the element's value could be written. | |
509 | * Negative values indicate an error. | |
510 | */ | |
511 | int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event, | |
512 | int is_open); | |
513 | ||
514 | /* | |
515 | * Machine interface for struct lttng_event_field. | |
516 | * | |
517 | * writer An instance of a mi writer. | |
518 | * field An event_field instance. | |
519 | * | |
520 | * Returns zero if the element's value could be written. | |
521 | * Negative values indicate an error. | |
522 | */ | |
523 | int mi_lttng_event_field(struct mi_writer *writer, | |
524 | struct lttng_event_field *field); | |
525 | ||
526 | /* | |
527 | * Machine interface: open a event_fields element. | |
528 | * | |
529 | * writer An instance of a machine interface writer. | |
530 | * | |
e4d484a5 | 531 | * Returns zero if the element have be written. |
5e18ec73 JR |
532 | * Negative values indicate an error. |
533 | */ | |
534 | int mi_lttng_event_fields_open(struct mi_writer *writer); | |
535 | ||
536 | /* | |
537 | * Machine interface: open a PIDs element. | |
538 | * | |
539 | * writer An instance of a machine interface writer. | |
540 | * | |
541 | * Returns zero if the element's value could be written. | |
542 | * Negative values indicate an error. | |
543 | */ | |
544 | int mi_lttng_pids_open(struct mi_writer *writer); | |
545 | ||
546 | /* | |
547 | * Machine interface of a PID. | |
548 | * | |
549 | * writer An instance of a machine interface writer. | |
550 | * pid A PID. | |
551 | * | |
552 | * is_open Defines whether or not the session element shall be closed. | |
553 | * This should be used carefully and the client | |
554 | * must close the pid element. | |
555 | * Use case: nested addition information on a domain | |
556 | * ex: channel event. | |
557 | * | |
558 | * Returns zero if the element's value could be written. | |
559 | * Negative values indicate an error. | |
560 | */ | |
561 | int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *cmdline, | |
562 | int is_open); | |
c7e35b03 | 563 | |
7e66b1b0 JRJ |
564 | /* |
565 | * Machine interface for struct lttng_calibrate. | |
566 | * | |
567 | * writer An instance of a machine interface writer. | |
568 | * | |
569 | * calibrate A lttng_calibrate instance. | |
570 | * | |
571 | * Returns zero if the element's value could be written. | |
572 | * Negative values indicate an error. | |
573 | */ | |
574 | int mi_lttng_calibrate(struct mi_writer *writer, | |
575 | struct lttng_calibrate *calibrate); | |
576 | ||
89b72577 JRJ |
577 | /* |
578 | * Machine interface of a context. | |
579 | * | |
580 | * writer An instance of a machine interface writer | |
581 | * | |
582 | * context An instance of a lttng_event_context | |
583 | * | |
584 | * is_open Define if we close the context element | |
585 | * This should be used carefully and the client | |
586 | * need to close the context element. | |
89b72577 JRJ |
587 | * Returns zero if the element's value could be written. |
588 | * Negative values indicate an error. | |
589 | */ | |
590 | int mi_lttng_context(struct mi_writer *writer, | |
591 | struct lttng_event_context *context, int is_open); | |
592 | ||
593 | /* | |
594 | * Machine interface of a perf_counter_context. | |
595 | * | |
596 | * writer An instance of a machine interface writer | |
597 | * | |
598 | * contest An instance of a lttng_event_perf_counter_ctx | |
599 | * | |
600 | * Returns zero if the element's value could be written. | |
601 | * Negative values indicate an error. | |
602 | */ | |
603 | int mi_lttng_perf_counter_context(struct mi_writer *writer, | |
604 | struct lttng_event_perf_counter_ctx *perf_context); | |
605 | ||
50534d6f JRJ |
606 | /* |
607 | * Machine interface of the snapshot list_output. | |
608 | * It specifies the session for which we are listing snapshots, | |
609 | * and it opens a snapshots element to list a sequence | |
610 | * of snapshots. | |
611 | * | |
612 | * writer An instance of a machine interface writer. | |
613 | * | |
614 | * session_name: Snapshot output for session "session_name". | |
615 | * | |
616 | * Note: The client has to close the session and the snapshots elements after | |
617 | * having listed every lttng_snapshot_output. | |
618 | * | |
619 | * Returns zero if the element's value could be written. | |
620 | * Negative values indicate an error. | |
621 | */ | |
622 | int mi_lttng_snapshot_output_session_name(struct mi_writer *writer, | |
623 | const char *session_name); | |
624 | ||
625 | /* | |
626 | * Machine interface of the snapshot output. | |
627 | * The machine interface serializes the following attributes: | |
628 | * - id: ID of the snapshot output. | |
629 | * - name: Name of the output. | |
630 | * - data_url : Destination of the output. | |
631 | * - ctrl_url: Destination of the output. | |
632 | * - max_size: total size of all stream combined. | |
633 | * | |
634 | * writer An instance of a machine interface writer. | |
635 | * | |
636 | * output: A list of snapshot_output. | |
637 | * | |
638 | * Returns zero if the element's value could be written. | |
639 | * Negative values indicate an error. | |
640 | */ | |
641 | int mi_lttng_snapshot_list_output(struct mi_writer *writer, | |
642 | struct lttng_snapshot_output *output); | |
643 | ||
644 | /* | |
645 | * Machine interface of the output of the command snapshot del output | |
646 | * when deleting a snapshot either by id or by name. | |
647 | * If the snapshot was found and successfully deleted using its id, | |
648 | * it return the id of the snapshot and the current session name on which it | |
649 | * was attached. | |
650 | * | |
651 | * Otherwise, it do the same process with the name of the snapshot, if the | |
652 | * snapshot output id is undefined. | |
653 | * | |
654 | * writer An instance of a machine interface writer. | |
655 | * | |
656 | * id: ID of the snapshot output. | |
657 | * | |
658 | * name: Name of the snapshot. | |
659 | * | |
660 | * current_session_name: Session to which the snapshot belongs. | |
661 | * | |
662 | * Returns zero if the element's value could be written. | |
663 | * Negative values indicate an error. | |
664 | */ | |
665 | int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id, | |
666 | const char *name, const char *current_session_name); | |
667 | ||
668 | /* | |
669 | * Machine interface of the output of the command snapshot add output | |
670 | * when adding a snapshot from a user URL. | |
671 | * | |
672 | * If the snapshot was successfully added, the machine interface lists | |
673 | * these information: | |
674 | * - id: ID of the newly add snapshot output. | |
675 | * - current_session_name: Name of the session to which the output was added. | |
676 | * - ctrl_url: Destination of the output. | |
677 | * - max_size: total size of all stream combined. | |
678 | * | |
679 | * writer An instance of a machine interface writer. | |
680 | * | |
681 | * current_session_name: Session to which the snapshot belongs. | |
682 | * | |
683 | * n_ptr: | |
684 | * | |
685 | * output: iterator over a lttng_snapshot_output_list which contain | |
686 | * the snapshot output informations. | |
687 | * | |
688 | * Returns zero if the element's value could be written. | |
689 | * Negative values indicate an error. | |
690 | */ | |
691 | int mi_lttng_snapshot_add_output(struct mi_writer *writer, | |
692 | const char *current_session_name, const char *n_ptr, | |
693 | struct lttng_snapshot_output *output); | |
694 | ||
695 | /* | |
696 | * Machine interface of the output of the command snapshot | |
697 | * record from a URL (if given). | |
698 | * | |
699 | * If the snapshot is successfully recorded from a url, the machine interface | |
700 | * output the following information: | |
701 | * - url: Destination of the output stored in the snapshot. | |
702 | * | |
703 | * Otherwise, the machine interface output the data and ctrl url received | |
704 | * from the command-line. | |
705 | * | |
706 | * writer An instance of a machine interface writer. | |
707 | * | |
708 | * current_session_name: Snapshot record for session "current_session_name". | |
709 | * | |
710 | * ctrl_url, data_url: Destination of the output receive from the command-line. | |
711 | * | |
712 | * Returns zero if the element's value could be written. | |
713 | * Negative values indicate an error. | |
714 | */ | |
715 | int mi_lttng_snapshot_record(struct mi_writer *writer, | |
716 | const char *current_session_name, const char *url, | |
717 | const char *cmdline_ctrl_url, const char *cmdline_data_url); | |
718 | ||
c7e35b03 | 719 | #endif /* _MI_LTTNG_H */ |