LTTng control library C API
Loading...
Searching...
No Matches
channel.h
1/*
2 * SPDX-FileCopyrightText: 2014 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_CHANNEL_H
9#define LTTNG_CHANNEL_H
10
11#include <lttng/domain.h>
12#include <lttng/event.h>
13#include <lttng/lttng-error.h>
14#include <lttng/lttng-export.h>
15
16#include <stdbool.h>
17#include <stdint.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
37
52
69
70/*
71 * Tracer channel attributes. For both kernel and user-space.
72 *
73 * The structures should be initialized to zero before use.
74 */
75#define LTTNG_CHANNEL_ATTR_PADDING1 (LTTNG_SYMBOL_NAME_LEN + 12)
76
143 int overwrite; /* -1: session default, 1: overwrite, 0: discard */
144
150 uint64_t subbuf_size; /* bytes, power of 2 */
151
156 uint64_t num_subbuf; /* power of 2 */
157
167 unsigned int switch_timer_interval; /* usec */
168
170 unsigned int read_timer_interval; /* usec */
171
173 enum lttng_event_output output; /* splice, mmap */
174
175 /* LTTng 2.1 padding limit */
176
182 uint64_t tracefile_size; /* bytes */
183
189 uint64_t tracefile_count; /* number of tracefiles */
190
191 /* LTTng 2.3 padding limit */
192
207 unsigned int live_timer_interval; /* usec */
208
209 /* LTTng 2.7 padding limit */
210 uint32_t align_to_64;
211 union {
212 uint64_t padding;
213 void *ptr;
214 } extended;
215
216 char padding[LTTNG_CHANNEL_ATTR_PADDING1];
217};
218
219/*
220 * Channel information structure. For both kernel and user-space.
221 *
222 * The structures should be initialized to zero before use.
223 */
224#define LTTNG_CHANNEL_PADDING1 16
225
271
281 uint32_t enabled;
282
285
286 char padding[LTTNG_CHANNEL_PADDING1];
287};
288
327LTTNG_EXPORT extern struct lttng_channel *lttng_channel_create(struct lttng_domain *domain);
328
348LTTNG_EXPORT extern void lttng_channel_destroy(struct lttng_channel *channel);
349
382LTTNG_EXPORT extern int lttng_list_channels(const struct lttng_handle *handle,
383 struct lttng_channel **channels);
384
450LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle,
451 struct lttng_channel *channel);
452
490LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle,
491 const char *channel_name);
492
512LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *domain,
513 struct lttng_channel_attr *attr);
514
555LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(const struct lttng_channel *channel,
556 uint64_t *count);
557
598LTTNG_EXPORT extern int lttng_channel_get_lost_packet_count(const struct lttng_channel *channel,
599 uint64_t *count);
600
631LTTNG_EXPORT extern int
632lttng_channel_get_monitor_timer_interval(const struct lttng_channel *channel, uint64_t *period);
633
663LTTNG_EXPORT extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *channel,
664 uint64_t period);
665
694LTTNG_EXPORT extern enum lttng_channel_status
695lttng_channel_get_watchdog_timer_interval(const struct lttng_channel *channel, uint64_t *period);
696
725LTTNG_EXPORT extern enum lttng_channel_status
727
779LTTNG_EXPORT extern int lttng_channel_get_blocking_timeout(const struct lttng_channel *channel,
780 int64_t *timeout);
781
833LTTNG_EXPORT extern int lttng_channel_set_blocking_timeout(struct lttng_channel *channel,
834 int64_t timeout);
835
866LTTNG_EXPORT extern enum lttng_error_code
869
899LTTNG_EXPORT extern enum lttng_error_code
902
931LTTNG_EXPORT extern enum lttng_channel_status
934
961LTTNG_EXPORT extern enum lttng_channel_status
964
997LTTNG_EXPORT extern enum lttng_channel_status
999 uint64_t *older_than_us);
1000
1027LTTNG_EXPORT extern enum lttng_channel_status
1029 uint64_t older_than_us);
1030
1031#ifdef __cplusplus
1032}
1033#endif
1034
1035#endif /* LTTNG_CHANNEL_H */
int lttng_channel_get_monitor_timer_interval(const struct lttng_channel *channel, uint64_t *period)
Sets *period to the monitor timer period (µs) property of the channel summary channel.
lttng_channel_preallocation_policy
Buffer preallocation policy of a channel.
Definition channel.h:45
int lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel *channel)
Creates or enables a channel summarized by channel within the recording session handle handle.
enum lttng_channel_status lttng_channel_get_watchdog_timer_interval(const struct lttng_channel *channel, uint64_t *period)
Sets *period to the watchdog timer period (µs) property of the channel summary channel.
lttng_channel_allocation_policy
Buffer allocation policy of a channel.
Definition channel.h:30
enum lttng_channel_status lttng_channel_set_preallocation_policy(struct lttng_channel *channel, enum lttng_channel_preallocation_policy policy)
Sets the buffer preallocation policy property of the channel summary channel to policy.
enum lttng_channel_status lttng_channel_set_automatic_memory_reclamation_policy(struct lttng_channel *channel, uint64_t older_than_us)
Sets the automatic memory reclaim policy of the channel summary channel to reclaim buffered data olde...
enum lttng_error_code lttng_channel_get_allocation_policy(const struct lttng_channel *channel, enum lttng_channel_allocation_policy *policy)
Sets *policy to the buffer allocation policy property of the channel summary channel.
int lttng_channel_get_lost_packet_count(const struct lttng_channel *channel, uint64_t *count)
Sets *count to the number of discarded packets (sub-buffers) of the channel summarized by channel.
int lttng_disable_channel(struct lttng_handle *handle, const char *channel_name)
Disables the channel named channel_name within the recording session handle handle.
lttng_channel_status
Status code for channel property accessors.
Definition channel.h:59
int lttng_channel_get_blocking_timeout(const struct lttng_channel *channel, int64_t *timeout)
Sets *timeout to the blocking timeout property of the channel summary channel.
enum lttng_channel_status lttng_channel_get_automatic_memory_reclamation_policy(const struct lttng_channel *channel, uint64_t *older_than_us)
Sets *older_than_us to the age threshold (µs) of the automatic memory reclaim of the channel summary ...
enum lttng_channel_status lttng_channel_get_preallocation_policy(const struct lttng_channel *channel, enum lttng_channel_preallocation_policy *policy)
Sets *policy to the buffer preallocation policy of the channel summary channel.
int lttng_channel_get_discarded_event_count(const struct lttng_channel *channel, uint64_t *count)
Sets *count to the number of discarded event records of the channel summarized by channel.
enum lttng_error_code lttng_channel_set_allocation_policy(struct lttng_channel *channel, enum lttng_channel_allocation_policy policy)
Sets the buffer allocation policy property of the channel summary channel to policy.
void lttng_channel_destroy(struct lttng_channel *channel)
Destroys the channel summary channel.
int lttng_channel_set_blocking_timeout(struct lttng_channel *channel, int64_t timeout)
Sets the blocking timeout property of the channel summary channel to timeout.
struct lttng_channel * lttng_channel_create(struct lttng_domain *domain)
Creates and returns a channel summary, setting the members of its lttng_channel::attr member to defau...
lttng_event_output
Channel output type.
Definition event.h:384
enum lttng_channel_status lttng_channel_set_watchdog_timer_interval(struct lttng_channel *channel, uint64_t period)
Sets the watchdog timer period property of the channel summary channel to period&#160;µs.
int lttng_channel_set_monitor_timer_interval(struct lttng_channel *channel, uint64_t period)
Sets the monitor timer period property of the channel summary channel to period&#160;µs.
void lttng_channel_set_default_attr(struct lttng_domain *domain, struct lttng_channel_attr *attr)
Sets the members of attr to their default values considering the tracing domain summary domain.
@ LTTNG_CHANNEL_PREALLOCATION_POLICY_PREALLOCATE
Preallocate sub-buffers.
Definition channel.h:47
@ LTTNG_CHANNEL_PREALLOCATION_POLICY_ON_DEMAND
Allocate sub-buffers as needed.
Definition channel.h:50
@ LTTNG_CHANNEL_ALLOCATION_POLICY_PER_CHANNEL
Per-channel buffering
Definition channel.h:35
@ LTTNG_CHANNEL_ALLOCATION_POLICY_PER_CPU
Per-CPU buffering
Definition channel.h:32
@ LTTNG_CHANNEL_STATUS_UNSET
Property is unset.
Definition channel.h:64
@ LTTNG_CHANNEL_STATUS_INVALID
Unsatisfied precondition.
Definition channel.h:67
@ LTTNG_CHANNEL_STATUS_OK
Success.
Definition channel.h:61
lttng_error_code
General error codes.
Definition lttng-error.h:49
#define LTTNG_SYMBOL_NAME_LEN
Maximum symbol length.
Definition constant.h:39
int lttng_list_channels(const struct lttng_handle *handle, struct lttng_channel **channels)
Sets *channels to the summaries of the channels of the recording session handle handle.
Attributes of a channel summary.
Definition channel.h:110
unsigned int live_timer_interval
Live timer period (µs), if applicable.
Definition channel.h:207
unsigned int switch_timer_interval
Switch timer period (µs), if applicable.
Definition channel.h:167
uint64_t tracefile_size
Maximum trace file size (bytes), or 0 for unlimited.
Definition channel.h:182
enum lttng_event_output output
Output type (Linux kernel channel).
Definition channel.h:173
unsigned int read_timer_interval
Read timer period (µs).
Definition channel.h:170
uint64_t num_subbuf
Sub-buffer count.
Definition channel.h:156
uint64_t subbuf_size
Sub-buffer size (bytes).
Definition channel.h:150
uint64_t tracefile_count
Maximum trace file count, or 0 for unlimited.
Definition channel.h:189
int overwrite
Event record loss mode.
Definition channel.h:143
Channel summary.
Definition channel.h:268
struct lttng_channel_attr attr
Other properties.
Definition channel.h:284
char name[LTTNG_SYMBOL_NAME_LEN]
Name.
Definition channel.h:270
uint32_t enabled
1 if this channel is enabled, or 0 otherwise.
Definition channel.h:281
Tracing domain summary.
Definition domain.h:103
Recording session handle.
Definition handle.h:44