LTTng control library C API
Loading...
Searching...
No Matches
session.h
1/*
2 * SPDX-FileCopyrightText: 2014 David Goulet <dgoulet@efficios.com>
3 * SPDX-FileCopyrightText: 2019 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only
6 *
7 */
8
9#ifndef LTTNG_SESSION_H
10#define LTTNG_SESSION_H
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#include <lttng/lttng-export.h>
17
23#include <lttng/constant.h>
24
25struct lttng_handle;
28
29#define LTTNG_SESSION_PADDING1 8
30
45
61
67 char path[PATH_MAX];
68
79 uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */
80
91 uint32_t snapshot_mode;
92
104 unsigned int live_timer_interval; /* usec */
105
106 /*
107 * End of public attributes.
108 * The remaining fields are used to deal with ABI management concerns.
109 */
110
111 /*
112 * 32-bit architectures are already naturally aligned on 4 bytes after
113 * 'live_timer_interval'. However, the offset does not result in a
114 * natural alignment on 64-bit architectures. Adding 4 bytes of
115 * padding here results in an aligned offset after 'alignement_padding'
116 * for both bitnesses.
117 *
118 * This was added since not all compilers appear to align unions in the
119 * same way. Some (e.g. MSVC) do not seem to impose an alignement
120 * constraint while others (e.g. gcc, clang, icc) seem to align it to
121 * ensure 'ptr' is naturally aligned.
122 */
123 char alignment_padding[4];
124 union {
125 /*
126 * Ensure the 'extended' union has the same size for both
127 * 32-bit and 64-bit builds.
128 */
129 char padding[LTTNG_SESSION_PADDING1];
130 void *ptr;
131 } extended;
132};
133
168LTTNG_EXPORT extern enum lttng_error_code
170
220LTTNG_EXPORT extern int lttng_create_session(const char *session_name, const char *output_url);
221
273LTTNG_EXPORT extern int lttng_create_session_snapshot(const char *session_name,
274 const char *output_url);
275
328LTTNG_EXPORT extern int lttng_create_session_live(const char *session_name,
329 const char *output_url,
330 unsigned int live_timer_period);
331
375LTTNG_EXPORT extern int lttng_destroy_session(const char *session_name);
376
421LTTNG_EXPORT extern int lttng_destroy_session_no_wait(const char *session_name);
422
472LTTNG_EXPORT extern enum lttng_error_code
473lttng_destroy_session_ext(const char *session_name, struct lttng_destruction_handle **handle);
474
498LTTNG_EXPORT extern int lttng_list_sessions(struct lttng_session **sessions);
499
537LTTNG_EXPORT extern enum lttng_error_code
538lttng_session_get_creation_time(const struct lttng_session *session, uint64_t *creation_timestamp);
539
581LTTNG_EXPORT extern int lttng_set_session_shm_path(const char *session_name, const char *shm_dir);
582
630LTTNG_EXPORT extern enum lttng_get_session_shm_path_status
631lttng_get_session_shm_path_override(const struct lttng_session *session, const char **shm_dir);
632
634
635#ifdef __cplusplus
636}
637#endif
638
639#endif /* LTTNG_SESSION_H */
lttng_error_code
General error codes.
Definition lttng-error.h:49
#define LTTNG_NAME_MAX
Maximum name length.
Definition constant.h:54
int lttng_destroy_session_no_wait(const char *session_name)
Initiates the destruction operation of the recording session named session_name.
int lttng_list_sessions(struct lttng_session **sessions)
Sets *sessions to the summaries of all the available recording sessions.
int lttng_create_session_live(const char *session_name, const char *output_url, unsigned int live_timer_period)
Creates a recording session named session_name in live mode, optionally setting its URL to output_url...
int lttng_set_session_shm_path(const char *session_name, const char *shm_dir)
Sets the path of the directory containing the shared memory files holding the channel ring buffers of...
enum lttng_error_code lttng_session_get_creation_time(const struct lttng_session *session, uint64_t *creation_timestamp)
Sets *creation_timestamp to the timestamp of the creation of the recording session summarized by sess...
enum lttng_error_code lttng_create_session_ext(struct lttng_session_descriptor *session_descriptor)
Creates a recording session from the recording session descriptor session_descriptor.
enum lttng_error_code lttng_destroy_session_ext(const char *session_name, struct lttng_destruction_handle **handle)
Initiates a destruction operation of the recording session named session_name.
int lttng_destroy_session(const char *session_name)
Destroys the recording session named session_name, blocking until the operation completes.
enum lttng_get_session_shm_path_status lttng_get_session_shm_path_override(const struct lttng_session *session, const char **shm_dir)
Sets *shm_dir to the path of the custom directory on the local file system containing the shared memo...
lttng_get_session_shm_path_status
Return type of lttng_get_session_shm_path_override().
Definition session.h:35
int lttng_create_session_snapshot(const char *session_name, const char *output_url)
Creates a recording session named session_name in snapshot mode, optionally setting the URL of its in...
int lttng_create_session(const char *session_name, const char *output_url)
Creates a recording session named session_name in local or network streaming mode,...
@ LTTNG_GET_SESSION_SHM_PATH_STATUS_INVALID_PARAMETER
Unsatisfied precondition.
Definition session.h:43
@ LTTNG_GET_SESSION_SHM_PATH_STATUS_OK
Success.
Definition session.h:37
@ LTTNG_GET_SESSION_SHM_PATH_STATUS_UNSET
Shared memory path isn't set.
Definition session.h:40
Recording session destruction handle (opaque type).
Recording session handle.
Definition handle.h:44
Recording session descriptor (opaque type).
Recording session summary.
Definition session.h:58
uint32_t enabled
1 if this recording session is active (started), or 0 otherwise.
Definition session.h:79
char path[PATH_MAX]
Human-readable representation of the output (local or remote).
Definition session.h:67
unsigned int live_timer_interval
Period (µs) of the live timers of the channels of this recording session, or 0 if this recording sess...
Definition session.h:104
char name[LTTNG_NAME_MAX]
Name.
Definition session.h:60
uint32_t snapshot_mode
1 if this recording session was created in snapshot mode, or 0 otherwise.
Definition session.h:91