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