23b7810c4680de3b50d694d5b5ae7afa43f5ba0b
[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 *
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
29 /* Don't want to reference snapshot-internal.h here */
30 struct lttng_snapshot_output;
31
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 */
46 char version_commit[NAME_MAX]; /* Commit hash of the current version */
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 extern const char * const mi_lttng_element_command;
53 extern const char * const mi_lttng_element_command_action;
54 extern const char * const mi_lttng_element_command_add_context;
55 extern const char * const mi_lttng_element_command_calibrate;
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_name;
65 extern const char * const mi_lttng_element_command_output;
66 extern const char * const mi_lttng_element_command_save;
67 extern const char * const mi_lttng_element_command_set_session;
68 extern const char * const mi_lttng_element_command_snapshot;
69 extern const char * const mi_lttng_element_command_snapshot_add;
70 extern const char * const mi_lttng_element_command_snapshot_del;
71 extern const char * const mi_lttng_element_command_snapshot_list;
72 extern const char * const mi_lttng_element_command_snapshot_record;
73 extern const char * const mi_lttng_element_command_start;
74 extern const char * const mi_lttng_element_command_stop;
75 extern const char * const mi_lttng_element_command_success;
76 extern const char * const mi_lttng_element_command_track;
77 extern const char * const mi_lttng_element_command_untrack;
78 extern const char * const mi_lttng_element_command_version;
79
80 /* Strings related to version command */
81 extern const char * const mi_lttng_element_version;
82 extern const char * const mi_lttng_element_version_commit;
83 extern const char * const mi_lttng_element_version_description;
84 extern const char * const mi_lttng_element_version_license;
85 extern const char * const mi_lttng_element_version_major;
86 extern const char * const mi_lttng_element_version_minor;
87 extern const char * const mi_lttng_element_version_patch_level;
88 extern const char * const mi_lttng_element_version_str;
89 extern const char * const mi_lttng_element_version_web;
90
91 /* String related to a lttng_event_field */
92 extern const char * const mi_lttng_element_event_field;
93 extern const char * const mi_lttng_element_event_fields;
94
95 /* String related to lttng_event_context */
96 extern const char * const mi_lttng_context_type_perf_counter;
97 extern const char * const mi_lttng_context_type_perf_cpu_counter;
98 extern const char * const mi_lttng_context_type_perf_thread_counter;
99
100 /* String related to lttng_event_perf_counter_ctx */
101 extern const char * const mi_lttng_element_perf_counter_context;
102
103 /* Strings related to pid */
104 extern const char * const mi_lttng_element_processes;
105 extern const char * const mi_lttng_element_process;
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
114 /* General element of mi_lttng */
115 extern const char * const mi_lttng_element_empty;
116 extern const char * const mi_lttng_element_id;
117 extern const char * const mi_lttng_element_nowrite;
118 extern const char * const mi_lttng_element_success;
119 extern const char * const mi_lttng_element_type_enum;
120 extern const char * const mi_lttng_element_type_float;
121 extern const char * const mi_lttng_element_type_integer;
122 extern const char * const mi_lttng_element_type_other;
123 extern const char * const mi_lttng_element_type_string;
124
125 /* String related to loglevel */
126 extern const char * const mi_lttng_loglevel_str_alert;
127 extern const char * const mi_lttng_loglevel_str_crit;
128 extern const char * const mi_lttng_loglevel_str_debug;
129 extern const char * const mi_lttng_loglevel_str_debug_function;
130 extern const char * const mi_lttng_loglevel_str_debug_line;
131 extern const char * const mi_lttng_loglevel_str_debug_module;
132 extern const char * const mi_lttng_loglevel_str_debug_process;
133 extern const char * const mi_lttng_loglevel_str_debug_program;
134 extern const char * const mi_lttng_loglevel_str_debug_system;
135 extern const char * const mi_lttng_loglevel_str_debug_unit;
136 extern const char * const mi_lttng_loglevel_str_emerg;
137 extern const char * const mi_lttng_loglevel_str_err;
138 extern const char * const mi_lttng_loglevel_str_info;
139 extern const char * const mi_lttng_loglevel_str_notice;
140 extern const char * const mi_lttng_loglevel_str_unknown;
141 extern const char * const mi_lttng_loglevel_str_warning;
142
143 /* String related to loglevel JUL */
144 extern const char * const mi_lttng_loglevel_str_jul_all;
145 extern const char * const mi_lttng_loglevel_str_jul_config;
146 extern const char * const mi_lttng_loglevel_str_jul_fine;
147 extern const char * const mi_lttng_loglevel_str_jul_finer;
148 extern const char * const mi_lttng_loglevel_str_jul_finest;
149 extern const char * const mi_lttng_loglevel_str_jul_info;
150 extern const char * const mi_lttng_loglevel_str_jul_off;
151 extern const char * const mi_lttng_loglevel_str_jul_severe;
152 extern const char * const mi_lttng_loglevel_str_jul_warning;
153
154 /* String related to loglevel Log4j */
155 extern const char * const mi_lttng_loglevel_str_log4j_off;
156 extern const char * const mi_lttng_loglevel_str_log4j_fatal;
157 extern const char * const mi_lttng_loglevel_str_log4j_error;
158 extern const char * const mi_lttng_loglevel_str_log4j_warn;
159 extern const char * const mi_lttng_loglevel_str_log4j_info;
160 extern const char * const mi_lttng_loglevel_str_log4j_debug;
161 extern const char * const mi_lttng_loglevel_str_log4j_trace;
162 extern const char * const mi_lttng_loglevel_str_log4j_all;
163
164 /* String related to loglevel Python */
165 extern const char * const mi_lttng_loglevel_str_python_critical;
166 extern const char * const mi_lttng_loglevel_str_python_error;
167 extern const char * const mi_lttng_loglevel_str_python_warning;
168 extern const char * const mi_lttng_loglevel_str_python_info;
169 extern const char * const mi_lttng_loglevel_str_python_debug;
170 extern const char * const mi_lttng_loglevel_str_python_notset;
171
172 /* String related to loglevel type */
173 extern const char * const mi_lttng_loglevel_type_all;
174 extern const char * const mi_lttng_loglevel_type_range;
175 extern const char * const mi_lttng_loglevel_type_single;
176 extern const char * const mi_lttng_loglevel_type_unknown;
177
178 /* Sting related to lttng_calibrate */
179 extern const char * const mi_lttng_element_calibrate;
180 extern const char * const mi_lttng_element_calibrate_function;
181
182 /* String related to a lttng_snapshot */
183 extern const char * const mi_lttng_element_snapshot_ctrl_url;
184 extern const char * const mi_lttng_element_snapshot_data_url;
185 extern const char * const mi_lttng_element_snapshot_max_size;
186 extern const char * const mi_lttng_element_snapshot_n_ptr;
187 extern const char * const mi_lttng_element_snapshot_session_name;
188 extern const char * const mi_lttng_element_snapshots;
189
190 /* Utility string function */
191 const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain);
192 const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value);
193 const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value);
194 const char *mi_lttng_domaintype_string(enum lttng_domain_type value);
195 const char *mi_lttng_buffertype_string(enum lttng_buffer_type value);
196 const char *mi_lttng_calibratetype_string(enum lttng_calibrate_type val);
197
198 /* String related to track/untrack command */
199 const char * const mi_lttng_element_track_untrack_targets;
200 const char * const mi_lttng_element_track_untrack_pid_target;
201 const char * const mi_lttng_element_track_untrack_all_wildcard;
202
203 /*
204 * Create an instance of a machine interface writer.
205 *
206 * fd_output File to which the XML content must be written. The file will be
207 * closed once the mi_writer has been destroyed.
208 *
209 * Returns an instance of a machine interface writer on success, NULL on
210 * error.
211 */
212 struct mi_writer *mi_lttng_writer_create(int fd_output, int mi_output_type);
213
214 /*
215 * Destroy an instance of a machine interface writer.
216 *
217 * writer An instance of a machine interface writer.
218 *
219 * Returns zero if the XML document could be closed cleanly. Negative values
220 * indicate an error.
221 */
222 int mi_lttng_writer_destroy(struct mi_writer *writer);
223
224 /*
225 * Open a command tag and add it's name node.
226 *
227 * writer An instance of a machine interface writer.
228 * command The command name.
229 *
230 * Returns zero if the XML document could be closed cleanly.
231 * Negative values indicate an error.
232 */
233 int mi_lttng_writer_command_open(struct mi_writer *writer, const char *command);
234
235 /*
236 * Close a command tag.
237 *
238 * writer An instance of a machine interface writer.
239 *
240 * Returns zero if the XML document could be closed cleanly.
241 * Negative values indicate an error.
242 */
243 int mi_lttng_writer_command_close(struct mi_writer *writer);
244
245 /*
246 * Open an element tag.
247 *
248 * writer An instance of a machine interface writer.
249 * element_name Element tag name.
250 *
251 * Returns zero if the XML document could be closed cleanly.
252 * Negative values indicate an error.
253 */
254 int mi_lttng_writer_open_element(struct mi_writer *writer,
255 const char *element_name);
256
257 /*
258 * Close the current element tag.
259 *
260 * writer An instance of a machine interface writer.
261 *
262 * Returns zero if the XML document could be closed cleanly.
263 * Negative values indicate an error.
264 */
265 int mi_lttng_writer_close_element(struct mi_writer *writer);
266
267 /*
268 * Close multiple element.
269 *
270 * writer An instance of a machine interface writer.
271 * nb_element Number of elements.
272 *
273 * Returns zero if the XML document could be closed cleanly.
274 * Negative values indicate an error.
275 */
276 int mi_lttng_close_multi_element(struct mi_writer *writer,
277 unsigned int nb_element);
278
279 /*
280 * Write an element of type unsigned int.
281 *
282 * writer An instance of a machine interface writer.
283 * element_name Element name.
284 * value Unsigned int value of the element
285 *
286 * Returns zero if the element's value could be written.
287 * Negative values indicate an error.
288 */
289 int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer,
290 const char *element_name, uint64_t value);
291
292 /*
293 * Write an element of type signed int.
294 *
295 * writer An instance of a machine interface writer.
296 * element_name Element name.
297 * value Signed int value of the element.
298 *
299 * Returns zero if the element's value could be written.
300 * Negative values indicate an error.
301 */
302 int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer,
303 const char *element_name, int64_t value);
304
305 /*
306 * Write an element of type boolean.
307 *
308 * writer An instance of a machine interface writer.
309 * element_name Element name.
310 * value Boolean value of the element.
311 *
312 * Returns zero if the element's value could be written.
313 * Negative values indicate an error.
314 */
315 int mi_lttng_writer_write_element_bool(struct mi_writer *writer,
316 const char *element_name, int value);
317
318 /*
319 * Write an element of type string.
320 *
321 * writer An instance of a machine interface writer.
322 * element_name Element name.
323 * value String value of the element.
324 *
325 * Returns zero if the element's value could be written.
326 * Negative values indicate an error.
327 */
328 int mi_lttng_writer_write_element_string(struct mi_writer *writer,
329 const char *element_name, const char *value);
330
331 /*
332 * Machine interface of struct version.
333 *
334 * writer An instance of a machine interface writer.
335 * version Version struct.
336 * lttng_description String value of the version description.
337 * lttng_license String value of the version license.
338 *
339 * Returns zero if the element's value could be written.
340 * Negative values indicate an error.
341 */
342 int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version *version,
343 const char *lttng_description, const char *lttng_license);
344
345 /*
346 * Machine interface: open a sessions element.
347 *
348 * writer An instance of a machine interface writer.
349 *
350 * Returns zero if the element's value could be written.
351 * Negative values indicate an error.
352 */
353 int mi_lttng_sessions_open(struct mi_writer *writer);
354
355 /*
356 * Machine interface of struct session.
357 *
358 * writer An instance of a machine interface writer.
359 * session An instance of a session.
360 * is_open Defines whether or not the session element shall be closed.
361 * This should be used carefully and the client
362 * must close the session element.
363 * Use case: nested additional information on a session
364 * ex: domain,channel event.
365 *
366 * Returns zero if the element's value could be written.
367 * Negative values indicate an error.
368 */
369 int mi_lttng_session(struct mi_writer *writer,
370 struct lttng_session *session, int is_open);
371
372 /*
373 * Machine interface: open a domains element.
374 *
375 * writer An instance of a machine interface writer.
376 *
377 * Returns zero if the element's value could be written.
378 * Negative values indicate an error.
379 */
380 int mi_lttng_domains_open(struct mi_writer *writer);
381
382 /*
383 * Machine interface of struct domain.
384 *
385 * writer An instance of a machine interface writer.
386 * domain An instance of a domain.
387 *
388 * is_open Defines whether or not the session element shall be closed.
389 * This should be used carefully and the client
390 * must close the domain element.
391 * Use case: nested addition information on a domain
392 * ex: channel event.
393 *
394 * Returns zero if the element's value could be written.
395 * Negative values indicate an error.
396 */
397 int mi_lttng_domain(struct mi_writer *writer,
398 struct lttng_domain *domain, int is_open);
399
400 /*
401 * Machine interface: open a channels element.
402 *
403 * writer An instance of a machine interface writer.
404 *
405 * Returns zero if the element's value could be written.
406 * Negative values indicate an error.
407 */
408 int mi_lttng_channels_open(struct mi_writer *writer);
409
410 /*
411 * Machine interface of struct channel.
412 *
413 * writer An instance of a machine interface writer.
414 * channel An instance of a channel.
415 *
416 * is_open Defines whether or not the session element shall be closed.
417 * This should be used carefully and the client
418 * must close the channel element.
419 * Use case: nested addition information on a channel.
420 * ex: channel event.
421 *
422 * Returns zero if the element's value could be written.
423 * Negative values indicate an error.
424 */
425 int mi_lttng_channel(struct mi_writer *writer,
426 struct lttng_channel *channel, int is_open);
427
428 /*
429 * Machine interface of struct channel_attr.
430 *
431 * writer An instance of a machine interface writer.
432 * attr An instance of a channel_attr struct.
433 *
434 * Returns zero if the element's value could be written.
435 * Negative values indicate an error.
436 */
437 int mi_lttng_channel_attr(struct mi_writer *writer,
438 struct lttng_channel_attr *attr);
439
440 /*
441 * Machine interface for event common attributes.
442 *
443 * writer An instance of a mi writer.
444 * event single trace event.
445 *
446 * The common attribute are:
447 * - mi event element
448 * - event name
449 * - event type
450 * - enabled tag
451 * - event filter
452 *
453 * Returns zero if the element's value could be written.
454 * Negative values indicate an error.
455 */
456 int mi_lttng_event_common_attributes(struct mi_writer *writer,
457 struct lttng_event *event);
458
459 /*
460 * Machine interface for kernel tracepoint event with a loglevel.
461 *
462 * writer An instance of a mi writer.
463 * event single trace event.
464 * domain Event's domain
465 *
466 * Returns zero if the element's value could be written.
467 * Negative values indicate an error.
468 */
469 int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
470 struct lttng_event *event, enum lttng_domain_type domain);
471
472 /*
473 * Machine interface for kernel tracepoint event with no loglevel.
474 *
475 * writer An instance of a mi writer.
476 * event single trace event.
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_no_loglevel(struct mi_writer *writer,
482 struct lttng_event *event);
483
484 /*
485 * Machine interface for kernel function and probe event.
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_function_probe(struct mi_writer *writer,
494 struct lttng_event *event);
495
496 /*
497 * Machine interface for kernel function entry 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_entry(struct mi_writer *writer,
506 struct lttng_event *event);
507
508 /*
509 * Machine interface: open an events element.
510 *
511 * writer An instance of a machine interface writer.
512 *
513 * Returns zero if the element's value could be written.
514 * Negative values indicate an error.
515 */
516 int mi_lttng_events_open(struct mi_writer *writer);
517
518 /*
519 * Machine interface for printing an event.
520 * The trace event type currently supported are:
521 * TRACEPOINT,
522 * PROBE,
523 * FUNCTION,
524 * FUNCTION_ENTRY,
525 * SYSCALL
526 *
527 * writer An instance of a mi writer.
528 * event single trace event.
529 * is_open Defines whether or not the session element shall be closed.
530 * This should be used carefully and the client
531 * must close the event element.
532 * Use case: nested additional information
533 * domain Event's domain
534 *
535 * Returns zero if the element's value could be written.
536 * Negative values indicate an error.
537 */
538 int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event,
539 int is_open, enum lttng_domain_type domain);
540
541 /*
542 * Machine interface for struct lttng_event_field.
543 *
544 * writer An instance of a mi writer.
545 * field An event_field instance.
546 *
547 * Returns zero if the element's value could be written.
548 * Negative values indicate an error.
549 */
550 int mi_lttng_event_field(struct mi_writer *writer,
551 struct lttng_event_field *field);
552
553 /*
554 * Machine interface: open a event_fields element.
555 *
556 * writer An instance of a machine interface writer.
557 *
558 * Returns zero if the element have be written.
559 * Negative values indicate an error.
560 */
561 int mi_lttng_event_fields_open(struct mi_writer *writer);
562
563 /*
564 * Machine interface: open a trackers element.
565 *
566 * writer An instance of a machine interface writer.
567 *
568 * Returns zero if the element's value could be written.
569 * Negative values indicate an error.
570 */
571 int mi_lttng_trackers_open(struct mi_writer *writer);
572
573 /*
574 * Machine interface: open a pid_tracker element.
575 *
576 * writer An instance of a machine interface writer.
577 *
578 * Returns zero if the element's value could be written.
579 * Negative values indicate an error.
580 *
581 * Note: A targets element is also opened for each tracker definition
582 */
583 int mi_lttng_pid_tracker_open(struct mi_writer *writer);
584
585 /*
586 * Machine interface: open a PIDs 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 int mi_lttng_pids_open(struct mi_writer *writer);
594
595 /*
596 * Machine interface: open a processes element.
597 *
598 * writer An instance of a machine interface writer.
599 *
600 * Returns zero if the element's value could be written.
601 * Negative values indicate an error.
602 */
603 int mi_lttng_processes_open(struct mi_writer *writer);
604
605 /*
606 * Machine interface of a Process.
607 *
608 * writer An instance of a machine interface writer.
609 * pid A PID.
610 *
611 * is_open Defines whether or not the session element shall be closed.
612 * This should be used carefully and the client
613 * must close the pid element.
614 * Use case: nested addition information on a domain
615 * ex: channel event.
616 *
617 * Returns zero if the element's value could be written.
618 * Negative values indicate an error.
619 */
620 int mi_lttng_process(struct mi_writer *writer, pid_t pid , const char *name,
621 int is_open);
622 /*
623 * Machine interface: open a targets element.
624 *
625 * writer An instance of a machine interface writer.
626 *
627 * Returns zero if the element's value could be written.
628 * Negative values indicate an error.
629 */
630 int mi_lttng_targets_open(struct mi_writer *writer);
631
632 /*
633 * Machine interface for track/untrack a pid_target
634 *
635 * writer An instance of a machine interface writer.
636 *
637 * Returns zero if the element's value could be written.
638 * Negative values indicate an error.
639 */
640 int mi_lttng_pid_target(struct mi_writer *writer, pid_t pid, int is_open);
641
642 /*
643 * Machine interface for struct lttng_calibrate.
644 *
645 * writer An instance of a machine interface writer.
646 *
647 * calibrate A lttng_calibrate instance.
648 *
649 * Returns zero if the element's value could be written.
650 * Negative values indicate an error.
651 */
652 int mi_lttng_calibrate(struct mi_writer *writer,
653 struct lttng_calibrate *calibrate);
654
655 /*
656 * Machine interface of a context.
657 *
658 * writer An instance of a machine interface writer
659 *
660 * context An instance of a lttng_event_context
661 *
662 * is_open Define if we close the context element
663 * This should be used carefully and the client
664 * need to close the context element.
665 * Returns zero if the element's value could be written.
666 * Negative values indicate an error.
667 */
668 int mi_lttng_context(struct mi_writer *writer,
669 struct lttng_event_context *context, int is_open);
670
671 /*
672 * Machine interface of a perf_counter_context.
673 *
674 * writer An instance of a machine interface writer
675 *
676 * contest An instance of a lttng_event_perf_counter_ctx
677 *
678 * Returns zero if the element's value could be written.
679 * Negative values indicate an error.
680 */
681 int mi_lttng_perf_counter_context(struct mi_writer *writer,
682 struct lttng_event_perf_counter_ctx *perf_context);
683
684 /*
685 * Machine interface of the snapshot list_output.
686 * It specifies the session for which we are listing snapshots,
687 * and it opens a snapshots element to list a sequence
688 * of snapshots.
689 *
690 * writer An instance of a machine interface writer.
691 *
692 * session_name: Snapshot output for session "session_name".
693 *
694 * Note: The client has to close the session and the snapshots elements after
695 * having listed every lttng_snapshot_output.
696 *
697 * Returns zero if the element's value could be written.
698 * Negative values indicate an error.
699 */
700 int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
701 const char *session_name);
702
703 /*
704 * Machine interface of the snapshot output.
705 * The machine interface serializes the following attributes:
706 * - id: ID of the snapshot output.
707 * - name: Name of the output.
708 * - data_url : Destination of the output.
709 * - ctrl_url: Destination of the output.
710 * - max_size: total size of all stream combined.
711 *
712 * writer An instance of a machine interface writer.
713 *
714 * output: A list of snapshot_output.
715 *
716 * Returns zero if the element's value could be written.
717 * Negative values indicate an error.
718 */
719 int mi_lttng_snapshot_list_output(struct mi_writer *writer,
720 struct lttng_snapshot_output *output);
721
722 /*
723 * Machine interface of the output of the command snapshot del output
724 * when deleting a snapshot either by id or by name.
725 * If the snapshot was found and successfully deleted using its id,
726 * it return the id of the snapshot and the current session name on which it
727 * was attached.
728 *
729 * Otherwise, it do the same process with the name of the snapshot, if the
730 * snapshot output id is undefined.
731 *
732 * writer An instance of a machine interface writer.
733 *
734 * id: ID of the snapshot output.
735 *
736 * name: Name of the snapshot.
737 *
738 * current_session_name: Session to which the snapshot belongs.
739 *
740 * Returns zero if the element's value could be written.
741 * Negative values indicate an error.
742 */
743 int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
744 const char *name, const char *current_session_name);
745
746 /*
747 * Machine interface of the output of the command snapshot add output
748 * when adding a snapshot from a user URL.
749 *
750 * If the snapshot was successfully added, the machine interface lists
751 * these information:
752 * - id: ID of the newly add snapshot output.
753 * - current_session_name: Name of the session to which the output was added.
754 * - ctrl_url: Destination of the output.
755 * - max_size: total size of all stream combined.
756 *
757 * writer An instance of a machine interface writer.
758 *
759 * current_session_name: Session to which the snapshot belongs.
760 *
761 * n_ptr:
762 *
763 * output: iterator over a lttng_snapshot_output_list which contain
764 * the snapshot output informations.
765 *
766 * Returns zero if the element's value could be written.
767 * Negative values indicate an error.
768 */
769 int mi_lttng_snapshot_add_output(struct mi_writer *writer,
770 const char *current_session_name, const char *n_ptr,
771 struct lttng_snapshot_output *output);
772
773 /*
774 * Machine interface of the output of the command snapshot
775 * record from a URL (if given).
776 *
777 * If the snapshot is successfully recorded from a url, the machine interface
778 * output the following information:
779 * - url: Destination of the output stored in the snapshot.
780 *
781 * Otherwise, the machine interface output the data and ctrl url received
782 * from the command-line.
783 *
784 * writer An instance of a machine interface writer.
785 *
786 * current_session_name: Snapshot record for session "current_session_name".
787 *
788 * ctrl_url, data_url: Destination of the output receive from the command-line.
789 *
790 * Returns zero if the element's value could be written.
791 * Negative values indicate an error.
792 */
793 int mi_lttng_snapshot_record(struct mi_writer *writer,
794 const char *current_session_name, const char *url,
795 const char *cmdline_ctrl_url, const char *cmdline_data_url);
796
797 #endif /* _MI_LTTNG_H */
This page took 0.045857 seconds and 3 git commands to generate.