4 * Linux Trace Toolkit Control Library Header File
6 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
8 * This library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License, version 2.1 only,
10 * as published by the Free Software Foundation.
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
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
25 /* Error codes that can be returned by API calls */
26 #include <lttng/lttng-error.h>
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>
42 /* Health component for the health check function. */
43 enum lttng_health_component
{
45 LTTNG_HEALTH_APP_MANAGE
,
48 LTTNG_HEALTH_CONSUMER
,
49 LTTNG_HEALTH_HT_CLEANUP
,
50 LTTNG_HEALTH_APP_MANAGE_NOTIFY
,
51 LTTNG_HEALTH_APP_REG_DISPATCH
,
55 enum lttng_calibrate_type
{
56 LTTNG_CALIBRATE_FUNCTION
= 0,
59 #define LTTNG_CALIBRATE_PADDING1 16
60 struct lttng_calibrate
{
61 enum lttng_calibrate_type type
;
63 char padding
[LTTNG_CALIBRATE_PADDING1
];
67 * Check if a session daemon is alive.
69 * Return 1 if alive or 0 if not. On error, returns a negative negative LTTng
72 extern int lttng_session_daemon_alive(void);
75 * Set the tracing group for the *current* flow of execution.
77 * On success, returns 0 else a negative LTTng error code.
79 extern int lttng_set_tracing_group(const char *name
);
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).
86 * NOTE that this is not recommended unless you absolutely know what you are
89 * Return 0 on success else a negative LTTng error code.
91 extern int lttng_register_consumer(struct lttng_handle
*handle
,
92 const char *socket_path
);
95 * Start tracing for *all* domain(s) in the session.
97 * Return 0 on success else a negative LTTng error code.
99 extern int lttng_start_tracing(const char *session_name
);
102 * Stop tracing for *all* domain(s) in the session.
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
106 * the guarantee that the data is ready to be read and analyze. Use the
107 * _no_wait call below to avoid this behavior.
109 * The session_name can't be NULL.
111 * Return 0 on success else a negative LTTng error code.
113 extern int lttng_stop_tracing(const char *session_name
);
116 * Behave exactly like lttng_stop_tracing but does not wait for data
119 extern int lttng_stop_tracing_no_wait(const char *session_name
);
122 * Calibrate LTTng overhead.
124 * The chan and handle params can not be NULL.
126 * Return 0 on success else a negative LTTng error code.
128 extern int lttng_calibrate(struct lttng_handle
*handle
,
129 struct lttng_calibrate
*calibrate
);
132 * Set URL for a consumer for a session and domain.
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.
137 * Default port are 5342 and 5343 respectively for control and data which uses
140 * URL format: proto://[HOST|IP][:PORT1[:PORT2]][/TRACE_PATH]
142 * Possible protocols are:
144 * Local filesystem full path.
147 * This will use the default network transport layer which is TCP for both
148 * control (PORT1) and data port (PORT2).
151 * TCP only streaming. For this one, both data and control URL must be given.
153 * Return 0 on success else a negative LTTng error code.
155 extern int lttng_set_consumer_url(struct lttng_handle
*handle
,
156 const char *control_url
, const char *data_url
);
159 * Enable the consumer for a session and domain.
161 extern LTTNG_DEPRECATED("This call is now obsolete.")
162 int lttng_enable_consumer(struct lttng_handle
*handle
);
165 * Disable consumer for a session and domain.
167 extern LTTNG_DEPRECATED("This call is now obsolete.")
168 int lttng_disable_consumer(struct lttng_handle
*handle
);
171 * Check session daemon health for a specific component.
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
177 * Any other positive value is an lttcomm error which can be translate with
180 * Please see lttng-health-check(3) man page for more information.
182 extern LTTNG_DEPRECATED("This call is now obsolete.")
183 int lttng_health_check(enum lttng_health_component c
);
186 * For a given session name, this call checks if the data is ready to be read
187 * or is still being extracted by the consumer(s) (pending) hence not ready to
188 * be used by any readers.
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().
195 extern int lttng_data_pending(const char *session_name
);