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#include <lttng/map/channel-descriptor.h>
28#include <lttng/map/channel-set.h>
29
30struct lttng_handle;
33
34#define LTTNG_SESSION_PADDING1 8
35
50
62
78
84 char path[PATH_MAX];
85
96 uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */
97
109
121 unsigned int live_timer_interval; /* usec */
122
123 /*
124 * End of public attributes.
125 * The remaining fields are used to deal with ABI management concerns.
126 */
127
128 /*
129 * 32-bit architectures are already naturally aligned on 4 bytes after
130 * 'live_timer_interval'. However, the offset does not result in a
131 * natural alignment on 64-bit architectures. Adding 4 bytes of
132 * padding here results in an aligned offset after 'alignement_padding'
133 * for both bitnesses.
134 *
135 * This was added since not all compilers appear to align unions in the
136 * same way. Some (e.g. MSVC) do not seem to impose an alignement
137 * constraint while others (e.g. gcc, clang, icc) seem to align it to
138 * ensure 'ptr' is naturally aligned.
139 */
140 char alignment_padding[4];
141 union {
142 /*
143 * Ensure the 'extended' union has the same size for both
144 * 32-bit and 64-bit builds.
145 */
146 char padding[LTTNG_SESSION_PADDING1];
147 void *ptr;
148 } extended;
149};
150
185LTTNG_EXPORT extern enum lttng_error_code
187
237LTTNG_EXPORT extern int lttng_create_session(const char *session_name, const char *output_url);
238
290LTTNG_EXPORT extern int lttng_create_session_snapshot(const char *session_name,
291 const char *output_url);
292
345LTTNG_EXPORT extern int lttng_create_session_live(const char *session_name,
346 const char *output_url,
347 unsigned int live_timer_period);
348
392LTTNG_EXPORT extern int lttng_destroy_session(const char *session_name);
393
438LTTNG_EXPORT extern int lttng_destroy_session_no_wait(const char *session_name);
439
489LTTNG_EXPORT extern enum lttng_error_code
490lttng_destroy_session_ext(const char *session_name, struct lttng_destruction_handle **handle);
491
515LTTNG_EXPORT extern int lttng_list_sessions(struct lttng_session **sessions);
516
554LTTNG_EXPORT extern enum lttng_error_code
555lttng_session_get_creation_time(const struct lttng_session *session, uint64_t *creation_timestamp);
556
598LTTNG_EXPORT extern int lttng_set_session_shm_path(const char *session_name, const char *shm_dir);
599
646LTTNG_EXPORT extern enum lttng_get_session_shm_path_status
647lttng_get_session_shm_path_override(const struct lttng_session *session, const char **shm_dir);
648
674LTTNG_EXPORT extern enum lttng_get_session_trace_format_status
676 enum lttng_trace_format *format);
677
725LTTNG_EXPORT extern enum lttng_error_code
726lttng_session_add_map_channel(const char *session_name,
727 const struct lttng_map_channel_descriptor *descriptor);
728
777LTTNG_EXPORT extern enum lttng_error_code
778lttng_session_list_map_channels(const char *session_name,
779 enum lttng_map_channel_type type,
780 struct lttng_map_channel_set **channels);
781
836LTTNG_EXPORT extern enum lttng_error_code
838 enum lttng_map_channel_type type,
839 const char *name,
840 struct lttng_map_channel **channel);
841
843
844#ifdef __cplusplus
845}
846#endif
847
848#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_map_channel_type
Type of a map channel.
Definition channel-type.h:25
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:55
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 event record channel ri...
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:40
enum lttng_error_code lttng_session_get_map_channel_by_name(const char *session_name, enum lttng_map_channel_type type, const char *name, struct lttng_map_channel **channel)
Sets *channel to the map channel of the recording session named session_name having the type type and...
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,...
enum lttng_error_code lttng_session_list_map_channels(const char *session_name, enum lttng_map_channel_type type, struct lttng_map_channel_set **channels)
Sets *channels to the map channels of the type type of the recording session named session_name.
enum lttng_error_code lttng_session_add_map_channel(const char *session_name, const struct lttng_map_channel_descriptor *descriptor)
Adds the map channel described by descriptor to the recording session named session_name.
@ LTTNG_GET_SESSION_TRACE_FORMAT_STATUS_OK
Success.
Definition session.h:57
@ LTTNG_GET_SESSION_TRACE_FORMAT_STATUS_INVALID
Unsatisfied precondition.
Definition session.h:60
@ LTTNG_GET_SESSION_SHM_PATH_STATUS_INVALID_PARAMETER
Unsatisfied precondition.
Definition session.h:48
@ LTTNG_GET_SESSION_SHM_PATH_STATUS_OK
Success.
Definition session.h:42
@ LTTNG_GET_SESSION_SHM_PATH_STATUS_UNSET
Shared memory path isn't set.
Definition session.h:45
Recording session destruction handle (opaque type).
Recording session handle.
Definition handle.h:44
Map channel descriptor (opaque type).
Set of map channels (opaque type).
Map channel (opaque type).
Recording session descriptor (opaque type).
Recording session summary.
Definition session.h:75
uint32_t enabled
1 if this recording session is active (started), or 0 otherwise.
Definition session.h:96
char path[PATH_MAX]
Human-readable representation of the output (local or remote).
Definition session.h:84
unsigned int live_timer_interval
Period (µs) of the live timers of the event record channels of this recording session,...
Definition session.h:121
char name[LTTNG_NAME_MAX]
Name.
Definition session.h:77
uint32_t snapshot_mode
1 if this recording session was created in snapshot mode, or 0 otherwise.
Definition session.h:108