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-export.h>
14
15#include <stdint.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
35
36/*
37 * Tracer channel attributes. For both kernel and user-space.
38 *
39 * The structures should be initialized to zero before use.
40 */
41#define LTTNG_CHANNEL_ATTR_PADDING1 (LTTNG_SYMBOL_NAME_LEN + 12)
42
109 int overwrite; /* -1: session default, 1: overwrite, 0: discard */
110
116 uint64_t subbuf_size; /* bytes, power of 2 */
117
122 uint64_t num_subbuf; /* power of 2 */
123
133 unsigned int switch_timer_interval; /* usec */
134
136 unsigned int read_timer_interval; /* usec */
137
139 enum lttng_event_output output; /* splice, mmap */
140
141 /* LTTng 2.1 padding limit */
142
148 uint64_t tracefile_size; /* bytes */
149
155 uint64_t tracefile_count; /* number of tracefiles */
156
157 /* LTTng 2.3 padding limit */
158
173 unsigned int live_timer_interval; /* usec */
174
175 /* LTTng 2.7 padding limit */
176 uint32_t align_to_64;
177 union {
178 uint64_t padding;
179 void *ptr;
180 } extended;
181
182 char padding[LTTNG_CHANNEL_ATTR_PADDING1];
183};
184
185/*
186 * Channel information structure. For both kernel and user-space.
187 *
188 * The structures should be initialized to zero before use.
189 */
190#define LTTNG_CHANNEL_PADDING1 16
191
232
242 uint32_t enabled;
243
246
247 char padding[LTTNG_CHANNEL_PADDING1];
248};
249
288LTTNG_EXPORT extern struct lttng_channel *lttng_channel_create(struct lttng_domain *domain);
289
309LTTNG_EXPORT extern void lttng_channel_destroy(struct lttng_channel *channel);
310
343LTTNG_EXPORT extern int lttng_list_channels(struct lttng_handle *handle,
344 struct lttng_channel **channels);
345
411LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle,
412 struct lttng_channel *channel);
413
451LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle,
452 const char *channel_name);
453
473LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *domain,
474 struct lttng_channel_attr *attr);
475
516LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(struct lttng_channel *channel,
517 uint64_t *count);
518
559LTTNG_EXPORT extern int lttng_channel_get_lost_packet_count(struct lttng_channel *channel,
560 uint64_t *count);
561
592LTTNG_EXPORT extern int
593lttng_channel_get_monitor_timer_interval(const struct lttng_channel *channel, uint64_t *period);
594
625LTTNG_EXPORT extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *channel,
626 uint64_t period);
627
679LTTNG_EXPORT extern int lttng_channel_get_blocking_timeout(const struct lttng_channel *channel,
680 int64_t *timeout);
681
733LTTNG_EXPORT extern int lttng_channel_set_blocking_timeout(struct lttng_channel *channel,
734 int64_t timeout);
735
766LTTNG_EXPORT extern enum lttng_error_code
769
799LTTNG_EXPORT extern enum lttng_error_code
802
803#ifdef __cplusplus
804}
805#endif
806
807#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.
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.
lttng_channel_allocation_policy
Buffer allocation policy of a channel.
Definition channel.h:28
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_disable_channel(struct lttng_handle *handle, const char *channel_name)
Disables the channel named channel_name within the recording session handle handle.
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.
int lttng_channel_get_lost_packet_count(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_channel_get_discarded_event_count(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
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_ALLOCATION_POLICY_PER_CHANNEL
Per-channel buffering
Definition channel.h:33
@ LTTNG_CHANNEL_ALLOCATION_POLICY_PER_CPU
Per-CPU buffering
Definition channel.h:30
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(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:76
unsigned int live_timer_interval
Live timer period (µs), if applicable.
Definition channel.h:173
unsigned int switch_timer_interval
Switch timer period (µs), if applicable.
Definition channel.h:133
uint64_t tracefile_size
Maximum trace file size (bytes), or 0 for unlimited.
Definition channel.h:148
enum lttng_event_output output
Output type (Linux kernel channel).
Definition channel.h:139
unsigned int read_timer_interval
Read timer period (µs).
Definition channel.h:136
uint64_t num_subbuf
Sub-buffer count.
Definition channel.h:122
uint64_t subbuf_size
Sub-buffer size (bytes).
Definition channel.h:116
uint64_t tracefile_count
Maximum trace file count, or 0 for unlimited.
Definition channel.h:155
int overwrite
Event record loss mode.
Definition channel.h:109
Channel summary.
Definition channel.h:229
struct lttng_channel_attr attr
Other properties.
Definition channel.h:245
char name[LTTNG_SYMBOL_NAME_LEN]
Name.
Definition channel.h:231
uint32_t enabled
1 if this channel is enabled, or 0 otherwise.
Definition channel.h:242
Tracing domain summary.
Definition domain.h:100
Recording session handle.
Definition handle.h:44