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/constant.h>
17#include <lttng/lttng-error.h>
18#include <lttng/lttng-export.h>
19#include <lttng/session-descriptor.h>
20
26#include <lttng/constant.h>
27
28struct lttng_handle;
31
32#define LTTNG_SESSION_PADDING1 8
33
48
60
76
82 char path[PATH_MAX];
83
94 uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */
95
107
119 unsigned int live_timer_interval; /* usec */
120
121 /*
122 * End of public attributes.
123 * The remaining fields are used to deal with ABI management concerns.
124 */
125
126 /*
127 * 32-bit architectures are already naturally aligned on 4 bytes after
128 * 'live_timer_interval'. However, the offset does not result in a
129 * natural alignment on 64-bit architectures. Adding 4 bytes of
130 * padding here results in an aligned offset after 'alignement_padding'
131 * for both bitnesses.
132 *
133 * This was added since not all compilers appear to align unions in the
134 * same way. Some (e.g. MSVC) do not seem to impose an alignement
135 * constraint while others (e.g. gcc, clang, icc) seem to align it to
136 * ensure 'ptr' is naturally aligned.
137 */
138 char alignment_padding[4];
139 union {
140 /*
141 * Ensure the 'extended' union has the same size for both
142 * 32-bit and 64-bit builds.
143 */
144 char padding[LTTNG_SESSION_PADDING1];
145 void *ptr;
146 } extended;
147};
148
183LTTNG_EXPORT extern enum lttng_error_code
185
235LTTNG_EXPORT extern int lttng_create_session(const char *session_name, const char *output_url);
236
288LTTNG_EXPORT extern int lttng_create_session_snapshot(const char *session_name,
289 const char *output_url);
290
343LTTNG_EXPORT extern int lttng_create_session_live(const char *session_name,
344 const char *output_url,
345 unsigned int live_timer_period);
346
390LTTNG_EXPORT extern int lttng_destroy_session(const char *session_name);
391
436LTTNG_EXPORT extern int lttng_destroy_session_no_wait(const char *session_name);
437
487LTTNG_EXPORT extern enum lttng_error_code
488lttng_destroy_session_ext(const char *session_name, struct lttng_destruction_handle **handle);
489
513LTTNG_EXPORT extern int lttng_list_sessions(struct lttng_session **sessions);
514
552LTTNG_EXPORT extern enum lttng_error_code
553lttng_session_get_creation_time(const struct lttng_session *session, uint64_t *creation_timestamp);
554
596LTTNG_EXPORT extern int lttng_set_session_shm_path(const char *session_name, const char *shm_dir);
597
644LTTNG_EXPORT extern enum lttng_get_session_shm_path_status
645lttng_get_session_shm_path_override(const struct lttng_session *session, const char **shm_dir);
646
672LTTNG_EXPORT extern enum lttng_get_session_trace_format_status
674 enum lttng_trace_format *format);
675
677
678#ifdef __cplusplus
679}
680#endif
681
682#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
lttng_trace_format
Trace format of a recording session.
Definition session-descriptor.h:51
int lttng_destroy_session_no_wait(const char *session_name)
Initiates the destruction operation of the recording session named session_name.
lttng_get_session_trace_format_status
Return type of lttng_get_session_trace_format().
Definition session.h:53
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_get_session_trace_format_status lttng_get_session_trace_format(const struct lttng_session *session, enum lttng_trace_format *format)
Sets *format to the trace format of the recording session summarized by session.
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:38
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_TRACE_FORMAT_STATUS_OK
Success.
Definition session.h:55
@ LTTNG_GET_SESSION_TRACE_FORMAT_STATUS_INVALID
Unsatisfied precondition.
Definition session.h:58
@ LTTNG_GET_SESSION_SHM_PATH_STATUS_INVALID_PARAMETER
Unsatisfied precondition.
Definition session.h:46
@ LTTNG_GET_SESSION_SHM_PATH_STATUS_OK
Success.
Definition session.h:40
@ LTTNG_GET_SESSION_SHM_PATH_STATUS_UNSET
Shared memory path isn't set.
Definition session.h:43
Recording session destruction handle (opaque type).
Recording session handle.
Definition handle.h:44
Recording session descriptor (opaque type).
Recording session summary.
Definition session.h:73
uint32_t enabled
1 if this recording session is active (started), or 0 otherwise.
Definition session.h:94
char path[PATH_MAX]
Human-readable representation of the output (local or remote).
Definition session.h:82
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:119
char name[LTTNG_NAME_MAX]
Name.
Definition session.h:75
uint32_t snapshot_mode
1 if this recording session was created in snapshot mode, or 0 otherwise.
Definition session.h:106