actions: introduce start session action
[lttng-tools.git] / include / lttng / lttng.h
index a1ccc451ee7a85786be12113597356cc001b363c..6b4ca565770b97b83409b70692ca76e00414dc40 100644 (file)
 /*
- * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * lttng.h
+ *
+ * Linux Trace Toolkit Control Library Header File
+ *
+ * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
  */
 
-#ifndef _LIBLTTNGCTL_H
-#define _LIBLTTNGCTL_H
+#ifndef LTTNG_H
+#define LTTNG_H
 
-#include <limits.h>
-#include <stdint.h>
-#include <uuid/uuid.h>
+/* Error codes that can be returned by API calls */
+#include <lttng/lttng-error.h>
+
+/* Include every LTTng ABI/API available. */
+#include <lttng/action/action.h>
+#include <lttng/action/notify.h>
+#include <lttng/action/start-session.h>
+#include <lttng/channel.h>
+#include <lttng/clear-handle.h>
+#include <lttng/clear.h>
+#include <lttng/condition/buffer-usage.h>
+#include <lttng/condition/condition.h>
+#include <lttng/condition/evaluation.h>
+#include <lttng/condition/session-consumed-size.h>
+#include <lttng/condition/session-rotation.h>
+#include <lttng/destruction-handle.h>
+#include <lttng/domain.h>
+#include <lttng/endpoint.h>
+#include <lttng/event.h>
+#include <lttng/handle.h>
+#include <lttng/health.h>
+#include <lttng/load.h>
+#include <lttng/location.h>
+#include <lttng/notification/channel.h>
+#include <lttng/notification/notification.h>
+#include <lttng/rotation.h>
+#include <lttng/save.h>
+#include <lttng/session-descriptor.h>
+#include <lttng/session.h>
+#include <lttng/snapshot.h>
+#include <lttng/tracker.h>
+#include <lttng/trigger/trigger.h>
+#include <lttng/userspace-probe.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum lttng_calibrate_type {
+       LTTNG_CALIBRATE_FUNCTION              = 0,
+};
 
-/* Default unix group name for tracing.
+/* Machine interface output type */
+enum lttng_mi_output_type {
+       LTTNG_MI_XML                          = 1 /* XML output */
+};
+
+#define LTTNG_CALIBRATE_PADDING1           16
+struct lttng_calibrate {
+       enum lttng_calibrate_type type;
+
+       char padding[LTTNG_CALIBRATE_PADDING1];
+};
+
+/*
+ * Check if a session daemon is alive.
+ *
+ * Return 1 if alive or 0 if not. On error, returns a negative negative LTTng
+ * error code.
  */
-#define DEFAULT_TRACING_GROUP "tracing"
+extern int lttng_session_daemon_alive(void);
 
-/* Environment variable to set session daemon
- * binary path.
+/*
+ * Set the tracing group for the *current* flow of execution.
+ *
+ * On success, returns 0 else a negative LTTng error code.
  */
-#define LTTNG_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH"
+extern int lttng_set_tracing_group(const char *name);
 
-/* UUID string length (including \0) */
-#define UUID_STR_LEN 37
-/* UUID short string version length (including \0) */
-#define UUID_SHORT_STR_LEN 9
+/*
+ * This call registers an "outside consumer" for a session and an lttng domain.
+ * No consumer will be spawned and all fds/commands will go through the socket
+ * path given (socket_path).
+ *
+ * NOTE that this is not recommended unless you absolutely know what you are
+ * doing.
+ *
+ * Return 0 on success else a negative LTTng error code.
+ */
+extern int lttng_register_consumer(struct lttng_handle *handle,
+               const char *socket_path);
 
-/* Trace type for lttng_trace.
+/*
+ * Start tracing for *all* domain(s) in the session.
+ *
+ * Return 0 on success else a negative LTTng error code.
  */
-enum lttng_trace_type {
-       KERNEL, USERSPACE,
-};
+extern int lttng_start_tracing(const char *session_name);
+
+/*
+ * Stop tracing for *all* domain(s) in the session.
+ *
+ * This call will wait for data availability for each domain of the session so
+ * this can take an abritrary amount of time. However, when returning you have
+ * the guarantee that the data is ready to be read and analyze. Use the
+ * _no_wait call below to avoid this behavior.
+ *
+ * The session_name can't be NULL.
+ *
+ * Return 0 on success else a negative LTTng error code.
+ */
+extern int lttng_stop_tracing(const char *session_name);
 
-/* Simple structure representing a session.
+/*
+ * Behave exactly like lttng_stop_tracing but does not wait for data
+ * availability.
  */
-struct lttng_session {
-       char name[NAME_MAX];
-       uuid_t uuid;
-};
+extern int lttng_stop_tracing_no_wait(const char *session_name);
 
-/* Simple trace representation.
+/*
+ * Deprecated: As of LTTng 2.9, this function always returns
+ * -LTTNG_ERR_UND.
  */
-struct lttng_trace {
-       char name[NAME_MAX];
-       pid_t pid;
-       enum lttng_trace_type type;
-};
+extern int lttng_calibrate(struct lttng_handle *handle,
+               struct lttng_calibrate *calibrate);
 
-extern int lttng_create_session(char *name);
-extern int lttng_destroy_session(uuid_t *uuid);
-extern int lttng_connect_sessiond(void);
-extern int lttng_disconnect_sessiond(void);
-extern int lttng_set_tracing_group(const char *name);
-extern int lttng_check_session_daemon(void);
-extern const char *lttng_get_readable_code(int code);
-extern int lttng_ust_list_apps(pid_t **pids);
-extern int lttng_list_sessions(struct lttng_session **sessions);
-extern int lttng_list_traces(uuid_t *uuid, struct lttng_trace **traces);
-extern void lttng_set_current_session_uuid(uuid_t *uuid);
-extern int lttng_ust_create_trace(pid_t pid);
-extern int lttng_ust_start_trace(pid_t pid);
-extern int lttng_ust_stop_trace(pid_t pid);
+/*
+ * Set URL for a consumer for a session and domain.
+ *
+ * Both data and control URL must be defined. If both URLs are the same, only
+ * the control URL is used even for network streaming.
+ *
+ * Default port are 5342 and 5343 respectively for control and data which uses
+ * the TCP protocol.
+ *
+ * URL format: proto://[HOST|IP][:PORT1[:PORT2]][/TRACE_PATH]
+ *
+ * Possible protocols are:
+ * > file://...
+ *   Local filesystem full path.
+ *
+ * > net[6]://...
+ *   This will use the default network transport layer which is TCP for both
+ *   control (PORT1) and data port (PORT2).
+ *
+ * > tcp[6]://...
+ *   TCP only streaming. For this one, both data and control URL must be given.
+ *
+ * Return 0 on success else a negative LTTng error code.
+ */
+extern int lttng_set_consumer_url(struct lttng_handle *handle,
+               const char *control_url, const char *data_url);
+
+/*
+ * For a given session name, this call checks if the data is ready to be read
+ * or is still being extracted by the consumer(s) (pending) hence not ready to
+ * be used by any readers.
+ *
+ * Return 0 if there is _no_ data pending in the buffers thus having a
+ * guarantee that the data can be read safely. Else, return 1 if there is still
+ * traced data is pending. On error, a negative value is returned and readable
+ * by lttng_strerror().
+ */
+extern int lttng_data_pending(const char *session_name);
+
+/*
+ * Deprecated, replaced by lttng_regenerate_metadata.
+ */
+LTTNG_DEPRECATED()
+extern int lttng_metadata_regenerate(const char *session_name);
 
 /*
- * Kernel tracer control
+ * Trigger the regeneration of the metadata for a session.
+ * The new metadata overwrite the previous one locally or remotely (through
+ * the lttng-relayd). Only kernel, per-uid and non-live sessions are supported.
+ * Return 0 on success, a negative LTTng error code on error.
  */
-extern int lttng_kernel_enable_event(char *event_name);
-extern int lttng_kernel_disable_event(char *event_name);
-extern int lttng_kernel_create_session(void);
-extern int lttng_kernel_start_tracing(void);
-extern int lttng_kernel_stop_tracing(void);
-extern int lttng_kernel_create_channel(void);
-extern int lttng_kernel_create_stream(void);
-extern int lttng_kernel_open_metadata(void);
-
-#endif /* _LIBLTTNGCTL_H */
+extern int lttng_regenerate_metadata(const char *session_name);
+
+/*
+ * Trigger the regeneration of the statedump for a session. The new statedump
+ * information is appended to the currently active trace, the session needs to
+ * be active.
+ *
+ * Return 0 on success, a negative LTTng error code on error.
+ */
+extern int lttng_regenerate_statedump(const char *session_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LTTNG_H */
This page took 0.026124 seconds and 4 git commands to generate.