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