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