Split lttng.h into several files
[lttng-tools.git] / include / lttng / lttng.h
CommitLineData
826d496d 1/*
b7384347
DG
2 * lttng.h
3 *
4 * Linux Trace Toolkit Control Library Header File
5 *
826d496d 6 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
fac6795d 7 *
1e46a50f 8 * This library is free software; you can redistribute it and/or modify it
d14d33bf
AM
9 * under the terms of the GNU Lesser General Public License, version 2.1 only,
10 * as published by the Free Software Foundation.
82a3637f 11 *
1e46a50f
TD
12 * This library is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15 * for more details.
82a3637f 16 *
1e46a50f
TD
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
fac6795d
DG
20 */
21
73db5be4
DG
22#ifndef LTTNG_H
23#define LTTNG_H
fac6795d 24
03b1319d
DG
25/* Error codes that can be returned by API calls */
26#include <lttng/lttng-error.h>
27
1239a312
DG
28/* Include every LTTng ABI/API available. */
29#include <lttng/channel.h>
30#include <lttng/domain.h>
31#include <lttng/event.h>
32#include <lttng/handle.h>
33#include <lttng/health.h>
34#include <lttng/save.h>
35#include <lttng/session.h>
36#include <lttng/snapshot.h>
37
5168918c
DG
38#ifdef __cplusplus
39extern "C" {
40#endif
41
44a5e5eb
DG
42/* Health component for the health check function. */
43enum lttng_health_component {
44 LTTNG_HEALTH_CMD,
139ac872 45 LTTNG_HEALTH_APP_MANAGE,
44a5e5eb
DG
46 LTTNG_HEALTH_APP_REG,
47 LTTNG_HEALTH_KERNEL,
48 LTTNG_HEALTH_CONSUMER,
0b2dc8df 49 LTTNG_HEALTH_HT_CLEANUP,
380e8d6f 50 LTTNG_HEALTH_APP_MANAGE_NOTIFY,
12e2b881 51 LTTNG_HEALTH_APP_REG_DISPATCH,
44a5e5eb
DG
52 LTTNG_HEALTH_ALL,
53};
54
1239a312
DG
55enum lttng_calibrate_type {
56 LTTNG_CALIBRATE_FUNCTION = 0,
54c90d10 57};
f3ed775e 58
8d326ab9 59#define LTTNG_CALIBRATE_PADDING1 16
d0254c7c
MD
60struct lttng_calibrate {
61 enum lttng_calibrate_type type;
8d326ab9
DG
62
63 char padding[LTTNG_CALIBRATE_PADDING1];
54c90d10 64};
d0254c7c 65
7d29a247
DG
66/*
67 * Check if a session daemon is alive.
1e46a50f 68 *
06662f07
DG
69 * Return 1 if alive or 0 if not. On error, returns a negative negative LTTng
70 * error code.
7d29a247 71 */
947308c4 72extern int lttng_session_daemon_alive(void);
f3ed775e 73
7d29a247 74/*
1e46a50f
TD
75 * Set the tracing group for the *current* flow of execution.
76 *
06662f07 77 * On success, returns 0 else a negative LTTng error code.
7d29a247 78 */
b7384347 79extern int lttng_set_tracing_group(const char *name);
f3ed775e 80
d9800920 81/*
1e46a50f
TD
82 * This call registers an "outside consumer" for a session and an lttng domain.
83 * No consumer will be spawned and all fds/commands will go through the socket
84 * path given (socket_path).
d9800920 85 *
06662f07
DG
86 * NOTE that this is not recommended unless you absolutely know what you are
87 * doing.
88 *
89 * Return 0 on success else a negative LTTng error code.
d9800920
DG
90 */
91extern int lttng_register_consumer(struct lttng_handle *handle,
92 const char *socket_path);
93
7d29a247 94/*
06662f07
DG
95 * Start tracing for *all* domain(s) in the session.
96 *
97 * Return 0 on success else a negative LTTng error code.
7d29a247 98 */
6a4f824d 99extern int lttng_start_tracing(const char *session_name);
f3ed775e 100
7d29a247 101/*
06662f07 102 * Stop tracing for *all* domain(s) in the session.
38ee087f
DG
103 *
104 * This call will wait for data availability for each domain of the session so
105 * this can take an abritrary amount of time. However, when returning you have
06662f07 106 * the guarantee that the data is ready to be read and analyze. Use the
38ee087f 107 * _no_wait call below to avoid this behavior.
41039c06
DG
108 *
109 * The session_name can't be NULL.
06662f07
DG
110 *
111 * Return 0 on success else a negative LTTng error code.
7d29a247 112 */
6a4f824d 113extern int lttng_stop_tracing(const char *session_name);
f3ed775e 114
38ee087f
DG
115/*
116 * Behave exactly like lttng_stop_tracing but does not wait for data
117 * availability.
118 */
119extern int lttng_stop_tracing_no_wait(const char *session_name);
120
d0254c7c
MD
121/*
122 * Calibrate LTTng overhead.
41039c06
DG
123 *
124 * The chan and handle params can not be NULL.
06662f07
DG
125 *
126 * Return 0 on success else a negative LTTng error code.
d0254c7c 127 */
cd80958d 128extern int lttng_calibrate(struct lttng_handle *handle,
d0254c7c
MD
129 struct lttng_calibrate *calibrate);
130
00e2e675 131/*
a4b92340
DG
132 * Set URL for a consumer for a session and domain.
133 *
134 * Both data and control URL must be defined. If both URLs are the same, only
135 * the control URL is used even for network streaming.
00e2e675 136 *
a4b92340
DG
137 * Default port are 5342 and 5343 respectively for control and data which uses
138 * the TCP protocol.
06662f07
DG
139 *
140 * URL format: proto://[HOST|IP][:PORT1[:PORT2]][/TRACE_PATH]
141 *
142 * Possible protocols are:
143 * > file://...
144 * Local filesystem full path.
145 *
146 * > net[6]://...
147 * This will use the default network transport layer which is TCP for both
148 * control (PORT1) and data port (PORT2).
149 *
150 * > tcp[6]://...
151 * TCP only streaming. For this one, both data and control URL must be given.
152 *
153 * Return 0 on success else a negative LTTng error code.
00e2e675 154 */
a4b92340
DG
155extern int lttng_set_consumer_url(struct lttng_handle *handle,
156 const char *control_url, const char *data_url);
00e2e675
DG
157
158/*
159 * Enable the consumer for a session and domain.
160 */
9c6bda17 161extern LTTNG_DEPRECATED("This call is now obsolete.")
785d2d0d 162int lttng_enable_consumer(struct lttng_handle *handle);
00e2e675
DG
163
164/*
165 * Disable consumer for a session and domain.
166 */
9c6bda17 167extern LTTNG_DEPRECATED("This call is now obsolete.")
785d2d0d 168int lttng_disable_consumer(struct lttng_handle *handle);
00e2e675 169
44a5e5eb
DG
170/*
171 * Check session daemon health for a specific component.
172 *
173 * Return 0 if health is OK or 1 if BAD. A returned value of -1 indicate that
174 * the control library was not able to connect to the session daemon health
175 * socket.
176 *
177 * Any other positive value is an lttcomm error which can be translate with
178 * lttng_strerror().
41039c06
DG
179 *
180 * Please see lttng-health-check(3) man page for more information.
44a5e5eb 181 */
d74df422
MD
182extern LTTNG_DEPRECATED("This call is now obsolete.")
183int lttng_health_check(enum lttng_health_component c);
44a5e5eb 184
806e2684
DG
185/*
186 * For a given session name, this call checks if the data is ready to be read
6d805429
DG
187 * or is still being extracted by the consumer(s) (pending) hence not ready to
188 * be used by any readers.
806e2684 189 *
6d805429
DG
190 * Return 0 if there is _no_ data pending in the buffers thus having a
191 * guarantee that the data can be read safely. Else, return 1 if there is still
192 * traced data is pending. On error, a negative value is returned and readable
193 * by lttng_strerror().
806e2684 194 */
6d805429 195extern int lttng_data_pending(const char *session_name);
806e2684 196
5168918c
DG
197#ifdef __cplusplus
198}
199#endif
200
73db5be4 201#endif /* LTTNG_H */
This page took 0.06444 seconds and 4 git commands to generate.