Fix: use pid element instead of process element
[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>
26#include <common/config/config.h>
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 {
42 char version[NAME_MAX]; /* Version number of package */
43 uint32_t version_major; /* LTTng-Tools major version number */
44 uint32_t version_minor; /* LTTng-Tools minor version number */
45 uint32_t version_patchlevel; /* LTTng-Tools patchlevel version number */
314d5222 46 char version_commit[NAME_MAX]; /* Commit hash of the current version */
c7e35b03
JR
47 char version_name[NAME_MAX];
48 char package_url[NAME_MAX]; /* Define to the home page for this package. */
49};
50
51/* Strings related to command */
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
a585578f
JR
196/* String related to track/untrack command */
197const char * const mi_lttng_element_track_untrack_targets;
198const char * const mi_lttng_element_track_untrack_pid_target;
199const char * const mi_lttng_element_track_untrack_all_wildcard;
200
c7e35b03
JR
201/*
202 * Create an instance of a machine interface writer.
203 *
204 * fd_output File to which the XML content must be written. The file will be
205 * closed once the mi_writer has been destroyed.
206 *
207 * Returns an instance of a machine interface writer on success, NULL on
208 * error.
209 */
210struct mi_writer *mi_lttng_writer_create(int fd_output, int mi_output_type);
211
212/*
213 * Destroy an instance of a machine interface writer.
214 *
215 * writer An instance of a machine interface writer.
216 *
217 * Returns zero if the XML document could be closed cleanly. Negative values
218 * indicate an error.
219 */
220int mi_lttng_writer_destroy(struct mi_writer *writer);
221
222/*
223 * Open a command tag and add it's name node.
224 *
225 * writer An instance of a machine interface writer.
c7e35b03
JR
226 * command The command name.
227 *
228 * Returns zero if the XML document could be closed cleanly.
229 * Negative values indicate an error.
230 */
231int mi_lttng_writer_command_open(struct mi_writer *writer, const char *command);
232
233/*
234 * Close a command tag.
235 *
236 * writer An instance of a machine interface writer.
237 *
238 * Returns zero if the XML document could be closed cleanly.
239 * Negative values indicate an error.
240 */
241int mi_lttng_writer_command_close(struct mi_writer *writer);
242
243/*
244 * Open an element tag.
245 *
246 * writer An instance of a machine interface writer.
c7e35b03
JR
247 * element_name Element tag name.
248 *
249 * Returns zero if the XML document could be closed cleanly.
250 * Negative values indicate an error.
251 */
252int mi_lttng_writer_open_element(struct mi_writer *writer,
253 const char *element_name);
254
255/*
256 * Close the current element tag.
257 *
258 * writer An instance of a machine interface writer.
259 *
260 * Returns zero if the XML document could be closed cleanly.
261 * Negative values indicate an error.
262 */
263int mi_lttng_writer_close_element(struct mi_writer *writer);
264
265/*
5e18ec73 266 * Close multiple element.
c7e35b03
JR
267 *
268 * writer An instance of a machine interface writer.
5e18ec73 269 * nb_element Number of elements.
c7e35b03 270 *
5e18ec73
JR
271 * Returns zero if the XML document could be closed cleanly.
272 * Negative values indicate an error.
273 */
274int mi_lttng_close_multi_element(struct mi_writer *writer,
275 unsigned int nb_element);
276
277/*
278 * Write an element of type unsigned int.
c7e35b03 279 *
5e18ec73
JR
280 * writer An instance of a machine interface writer.
281 * element_name Element name.
c7e35b03
JR
282 * value Unsigned int value of the element
283 *
284 * Returns zero if the element's value could be written.
285 * Negative values indicate an error.
286 */
287int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer,
288 const char *element_name, uint64_t value);
289
290/*
291 * Write an element of type signed int.
292 *
293 * writer An instance of a machine interface writer.
c7e35b03 294 * element_name Element name.
5e18ec73 295 * value Signed int value of the element.
c7e35b03
JR
296 *
297 * Returns zero if the element's value could be written.
298 * Negative values indicate an error.
299 */
300int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer,
301 const char *element_name, int64_t value);
302
303/*
304 * Write an element of type boolean.
305 *
306 * writer An instance of a machine interface writer.
c7e35b03 307 * element_name Element name.
5e18ec73 308 * value Boolean value of the element.
c7e35b03
JR
309 *
310 * Returns zero if the element's value could be written.
311 * Negative values indicate an error.
312 */
313int mi_lttng_writer_write_element_bool(struct mi_writer *writer,
314 const char *element_name, int value);
315
316/*
317 * Write an element of type string.
318 *
319 * writer An instance of a machine interface writer.
c7e35b03 320 * element_name Element name.
5e18ec73 321 * value String value of the element.
c7e35b03
JR
322 *
323 * Returns zero if the element's value could be written.
324 * Negative values indicate an error.
325 */
326int mi_lttng_writer_write_element_string(struct mi_writer *writer,
327 const char *element_name, const char *value);
328
329/*
330 * Machine interface of struct version.
331 *
332 * writer An instance of a machine interface writer.
c7e35b03 333 * version Version struct.
c7e35b03 334 * lttng_description String value of the version description.
c7e35b03
JR
335 * lttng_license String value of the version license.
336 *
337 * Returns zero if the element's value could be written.
338 * Negative values indicate an error.
339 */
340int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version *version,
341 const char *lttng_description, const char *lttng_license);
342
343/*
5e18ec73 344 * Machine interface: open a sessions element.
c7e35b03 345 *
5e18ec73 346 * writer An instance of a machine interface writer.
c7e35b03 347 *
5e18ec73
JR
348 * Returns zero if the element's value could be written.
349 * Negative values indicate an error.
350 */
351int mi_lttng_sessions_open(struct mi_writer *writer);
352
353/*
354 * Machine interface of struct session.
c7e35b03 355 *
5e18ec73
JR
356 * writer An instance of a machine interface writer.
357 * session An instance of a session.
358 * is_open Defines whether or not the session element shall be closed.
359 * This should be used carefully and the client
360 * must close the session element.
136f2f81 361 * Use case: nested additional information on a session
c7e35b03 362 * ex: domain,channel event.
c7e35b03
JR
363 *
364 * Returns zero if the element's value could be written.
365 * Negative values indicate an error.
366 */
367int mi_lttng_session(struct mi_writer *writer,
5e18ec73
JR
368 struct lttng_session *session, int is_open);
369
370/*
371 * Machine interface: open a domains element.
372 *
373 * writer An instance of a machine interface writer.
374 *
375 * Returns zero if the element's value could be written.
376 * Negative values indicate an error.
377 */
378int mi_lttng_domains_open(struct mi_writer *writer);
379
380/*
381 * Machine interface of struct domain.
382 *
383 * writer An instance of a machine interface writer.
384 * domain An instance of a domain.
385 *
386 * is_open Defines whether or not the session element shall be closed.
387 * This should be used carefully and the client
388 * must close the domain element.
389 * Use case: nested addition information on a domain
390 * ex: channel event.
391 *
392 * Returns zero if the element's value could be written.
393 * Negative values indicate an error.
394 */
395int mi_lttng_domain(struct mi_writer *writer,
396 struct lttng_domain *domain, int is_open);
397
398/*
399 * Machine interface: open a channels element.
400 *
401 * writer An instance of a machine interface writer.
402 *
403 * Returns zero if the element's value could be written.
404 * Negative values indicate an error.
405 */
406int mi_lttng_channels_open(struct mi_writer *writer);
407
408/*
409 * Machine interface of struct channel.
410 *
411 * writer An instance of a machine interface writer.
412 * channel An instance of a channel.
413 *
414 * is_open Defines whether or not the session element shall be closed.
415 * This should be used carefully and the client
416 * must close the channel element.
417 * Use case: nested addition information on a channel.
418 * ex: channel event.
419 *
420 * Returns zero if the element's value could be written.
421 * Negative values indicate an error.
422 */
423int mi_lttng_channel(struct mi_writer *writer,
424 struct lttng_channel *channel, int is_open);
425
426/*
427 * Machine interface of struct channel_attr.
428 *
429 * writer An instance of a machine interface writer.
430 * attr An instance of a channel_attr struct.
431 *
432 * Returns zero if the element's value could be written.
433 * Negative values indicate an error.
434 */
435int mi_lttng_channel_attr(struct mi_writer *writer,
436 struct lttng_channel_attr *attr);
437
438/*
439* Machine interface for event common attributes.
440*
441* writer An instance of a mi writer.
442* event single trace event.
443*
444* The common attribute are:
445* - mi event element
446* - event name
447* - event type
448* - enabled tag
449* - event filter
450*
451* Returns zero if the element's value could be written.
452* Negative values indicate an error.
453*/
454int mi_lttng_event_common_attributes(struct mi_writer *writer,
455 struct lttng_event *event);
456
457/*
458 * Machine interface for kernel tracepoint event with a loglevel.
459 *
460 * writer An instance of a mi writer.
461 * event single trace event.
970d848b 462 * domain Event's domain
5e18ec73
JR
463 *
464 * Returns zero if the element's value could be written.
465 * Negative values indicate an error.
466 */
467int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
970d848b 468 struct lttng_event *event, enum lttng_domain_type domain);
5e18ec73
JR
469
470/*
471 * Machine interface for kernel tracepoint event with no loglevel.
472 *
473 * writer An instance of a mi writer.
474 * event single trace event.
475 *
476 * Returns zero if the element's value could be written.
477 * Negative values indicate an error.
478 */
479int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer,
480 struct lttng_event *event);
481
482/*
483 * Machine interface for kernel function and probe event.
484 *
485 * writer An instance of a mi writer.
486 * event single trace event.
487 *
488 * Returns zero if the element's value could be written.
489 * Negative values indicate an error.
490 */
491int mi_lttng_event_function_probe(struct mi_writer *writer,
492 struct lttng_event *event);
493
494/*
495 * Machine interface for kernel function entry event.
496 *
497 * writer An instance of a mi writer.
498 * event single trace event.
499 *
500 * Returns zero if the element's value could be written.
501 * Negative values indicate an error.
502 */
503int mi_lttng_event_function_entry(struct mi_writer *writer,
504 struct lttng_event *event);
505
506/*
507 * Machine interface: open an events element.
508 *
509 * writer An instance of a machine interface writer.
510 *
511 * Returns zero if the element's value could be written.
512 * Negative values indicate an error.
513 */
514int mi_lttng_events_open(struct mi_writer *writer);
515
516/*
517 * Machine interface for printing an event.
518 * The trace event type currently supported are:
519 * TRACEPOINT,
520 * PROBE,
521 * FUNCTION,
522 * FUNCTION_ENTRY,
523 * SYSCALL
524 *
525 * writer An instance of a mi writer.
526 * event single trace event.
527 * is_open Defines whether or not the session element shall be closed.
528 * This should be used carefully and the client
529 * must close the event element.
530 * Use case: nested additional information
970d848b 531 * domain Event's domain
5e18ec73
JR
532 *
533 * Returns zero if the element's value could be written.
534 * Negative values indicate an error.
535 */
536int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event,
970d848b 537 int is_open, enum lttng_domain_type domain);
5e18ec73
JR
538
539/*
540 * Machine interface for struct lttng_event_field.
541 *
542 * writer An instance of a mi writer.
543 * field An event_field instance.
544 *
545 * Returns zero if the element's value could be written.
546 * Negative values indicate an error.
547 */
548int mi_lttng_event_field(struct mi_writer *writer,
549 struct lttng_event_field *field);
550
551/*
552 * Machine interface: open a event_fields element.
553 *
554 * writer An instance of a machine interface writer.
555 *
e4d484a5 556 * Returns zero if the element have be written.
5e18ec73
JR
557 * Negative values indicate an error.
558 */
559int mi_lttng_event_fields_open(struct mi_writer *writer);
560
a585578f
JR
561/*
562 * Machine interface: open a trackers element.
563 *
564 * writer An instance of a machine interface writer.
565 *
566 * Returns zero if the element's value could be written.
567 * Negative values indicate an error.
568 */
569int mi_lttng_trackers_open(struct mi_writer *writer);
570
571/*
572 * Machine interface: open a pid_tracker element.
573 *
574 * writer An instance of a machine interface writer.
575 *
576 * Returns zero if the element's value could be written.
577 * Negative values indicate an error.
578 *
579 * Note: A targets element is also opened for each tracker definition
580 */
581int mi_lttng_pid_tracker_open(struct mi_writer *writer);
582
5e18ec73
JR
583/*
584 * Machine interface: open a PIDs element.
585 *
586 * writer An instance of a machine interface writer.
587 *
588 * Returns zero if the element's value could be written.
589 * Negative values indicate an error.
590 */
591int mi_lttng_pids_open(struct mi_writer *writer);
592
593/*
a585578f
JR
594 * Machine interface: open a processes element.
595 *
596 * writer An instance of a machine interface writer.
597 *
598 * Returns zero if the element's value could be written.
599 * Negative values indicate an error.
600 */
601int mi_lttng_processes_open(struct mi_writer *writer);
602
603/*
604 * Machine interface of a Process.
5e18ec73
JR
605 *
606 * writer An instance of a machine interface writer.
607 * pid A PID.
608 *
609 * is_open Defines whether or not the session element shall be closed.
610 * This should be used carefully and the client
611 * must close the pid element.
612 * Use case: nested addition information on a domain
613 * ex: channel event.
614 *
615 * Returns zero if the element's value could be written.
616 * Negative values indicate an error.
617 */
a585578f 618int mi_lttng_process(struct mi_writer *writer, pid_t pid , const char *name,
5e18ec73 619 int is_open);
103d0bfb
JR
620
621/*
622 * TODO: move pid of lttng list -u to process semantic on mi api bump
623 * Machine interface of a Process.
624 *
625 * writer An instance of a machine interface writer.
626 * pid A PID.
627 *
628 * is_open Defines whether or not the session element shall be closed.
629 * This should be used carefully and the client
630 * must close the pid element.
631 * Use case: nested addition information on a domain
632 * ex: channel event.
633 *
634 * Returns zero if the element's value could be written.
635 * Negative values indicate an error.
636 */
637int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *name,
638 int is_open);
a585578f
JR
639/*
640 * Machine interface: open a targets element.
641 *
642 * writer An instance of a machine interface writer.
643 *
644 * Returns zero if the element's value could be written.
645 * Negative values indicate an error.
646 */
647int mi_lttng_targets_open(struct mi_writer *writer);
648
649/*
650 * Machine interface for track/untrack a pid_target
651 *
652 * writer An instance of a machine interface writer.
653 *
654 * Returns zero if the element's value could be written.
655 * Negative values indicate an error.
656 */
657int mi_lttng_pid_target(struct mi_writer *writer, pid_t pid, int is_open);
c7e35b03 658
7e66b1b0
JRJ
659/*
660 * Machine interface for struct lttng_calibrate.
661 *
662 * writer An instance of a machine interface writer.
663 *
664 * calibrate A lttng_calibrate instance.
665 *
666 * Returns zero if the element's value could be written.
667 * Negative values indicate an error.
668 */
669int mi_lttng_calibrate(struct mi_writer *writer,
670 struct lttng_calibrate *calibrate);
671
89b72577
JRJ
672/*
673 * Machine interface of a context.
674 *
675 * writer An instance of a machine interface writer
676 *
677 * context An instance of a lttng_event_context
678 *
679 * is_open Define if we close the context element
680 * This should be used carefully and the client
681 * need to close the context element.
89b72577
JRJ
682 * Returns zero if the element's value could be written.
683 * Negative values indicate an error.
684 */
685int mi_lttng_context(struct mi_writer *writer,
686 struct lttng_event_context *context, int is_open);
687
688/*
689 * Machine interface of a perf_counter_context.
690 *
691 * writer An instance of a machine interface writer
692 *
693 * contest An instance of a lttng_event_perf_counter_ctx
694 *
695 * Returns zero if the element's value could be written.
696 * Negative values indicate an error.
697 */
698int mi_lttng_perf_counter_context(struct mi_writer *writer,
699 struct lttng_event_perf_counter_ctx *perf_context);
700
50534d6f
JRJ
701/*
702 * Machine interface of the snapshot list_output.
703 * It specifies the session for which we are listing snapshots,
704 * and it opens a snapshots element to list a sequence
705 * of snapshots.
706 *
707 * writer An instance of a machine interface writer.
708 *
709 * session_name: Snapshot output for session "session_name".
710 *
711 * Note: The client has to close the session and the snapshots elements after
712 * having listed every lttng_snapshot_output.
713 *
714 * Returns zero if the element's value could be written.
715 * Negative values indicate an error.
716 */
717int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
718 const char *session_name);
719
720/*
721 * Machine interface of the snapshot output.
722 * The machine interface serializes the following attributes:
723 * - id: ID of the snapshot output.
724 * - name: Name of the output.
725 * - data_url : Destination of the output.
726 * - ctrl_url: Destination of the output.
727 * - max_size: total size of all stream combined.
728 *
729 * writer An instance of a machine interface writer.
730 *
731 * output: A list of snapshot_output.
732 *
733 * Returns zero if the element's value could be written.
734 * Negative values indicate an error.
735 */
736int mi_lttng_snapshot_list_output(struct mi_writer *writer,
737 struct lttng_snapshot_output *output);
738
739/*
740 * Machine interface of the output of the command snapshot del output
741 * when deleting a snapshot either by id or by name.
742 * If the snapshot was found and successfully deleted using its id,
743 * it return the id of the snapshot and the current session name on which it
744 * was attached.
745 *
746 * Otherwise, it do the same process with the name of the snapshot, if the
747 * snapshot output id is undefined.
748 *
749 * writer An instance of a machine interface writer.
750 *
751 * id: ID of the snapshot output.
752 *
753 * name: Name of the snapshot.
754 *
755 * current_session_name: Session to which the snapshot belongs.
756 *
757 * Returns zero if the element's value could be written.
758 * Negative values indicate an error.
759 */
760int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
761 const char *name, const char *current_session_name);
762
763/*
764 * Machine interface of the output of the command snapshot add output
765 * when adding a snapshot from a user URL.
766 *
767 * If the snapshot was successfully added, the machine interface lists
768 * these information:
769 * - id: ID of the newly add snapshot output.
770 * - current_session_name: Name of the session to which the output was added.
771 * - ctrl_url: Destination of the output.
772 * - max_size: total size of all stream combined.
773 *
774 * writer An instance of a machine interface writer.
775 *
776 * current_session_name: Session to which the snapshot belongs.
777 *
778 * n_ptr:
779 *
780 * output: iterator over a lttng_snapshot_output_list which contain
781 * the snapshot output informations.
782 *
783 * Returns zero if the element's value could be written.
784 * Negative values indicate an error.
785 */
786int mi_lttng_snapshot_add_output(struct mi_writer *writer,
787 const char *current_session_name, const char *n_ptr,
788 struct lttng_snapshot_output *output);
789
790/*
791 * Machine interface of the output of the command snapshot
792 * record from a URL (if given).
793 *
794 * If the snapshot is successfully recorded from a url, the machine interface
795 * output the following information:
796 * - url: Destination of the output stored in the snapshot.
797 *
798 * Otherwise, the machine interface output the data and ctrl url received
799 * from the command-line.
800 *
801 * writer An instance of a machine interface writer.
802 *
803 * current_session_name: Snapshot record for session "current_session_name".
804 *
805 * ctrl_url, data_url: Destination of the output receive from the command-line.
806 *
807 * Returns zero if the element's value could be written.
808 * Negative values indicate an error.
809 */
810int mi_lttng_snapshot_record(struct mi_writer *writer,
811 const char *current_session_name, const char *url,
812 const char *cmdline_ctrl_url, const char *cmdline_data_url);
813
c7e35b03 814#endif /* _MI_LTTNG_H */
This page took 0.075469 seconds and 4 git commands to generate.