2 * Copyright (C) 2014 David Goulet <dgoulet@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_CHANNEL_H
9 #define LTTNG_CHANNEL_H
11 #include <lttng/domain.h>
12 #include <lttng/event.h>
13 #include <lttng/lttng-export.h>
21 * Tracer channel attributes. For both kernel and user-space.
23 * The structures should be initialized to zero before use.
25 #define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
26 struct lttng_channel_attr
{
27 int overwrite
; /* -1: session default, 1: overwrite, 0: discard */
28 uint64_t subbuf_size
; /* bytes, power of 2 */
29 uint64_t num_subbuf
; /* power of 2 */
30 unsigned int switch_timer_interval
; /* usec */
31 unsigned int read_timer_interval
; /* usec */
32 enum lttng_event_output output
; /* splice, mmap */
33 /* LTTng 2.1 padding limit */
34 uint64_t tracefile_size
; /* bytes */
35 uint64_t tracefile_count
; /* number of tracefiles */
36 /* LTTng 2.3 padding limit */
37 unsigned int live_timer_interval
; /* usec */
38 /* LTTng 2.7 padding limit */
45 char padding
[LTTNG_CHANNEL_ATTR_PADDING1
];
49 * Channel information structure. For both kernel and user-space.
51 * The structures should be initialized to zero before use.
53 #define LTTNG_CHANNEL_PADDING1 16
54 struct lttng_channel
{
55 char name
[LTTNG_SYMBOL_NAME_LEN
];
57 struct lttng_channel_attr attr
;
59 char padding
[LTTNG_CHANNEL_PADDING1
];
64 LTTNG_EXPORT
extern struct lttng_channel
*lttng_channel_create(struct lttng_domain
*domain
);
68 LTTNG_EXPORT
extern void lttng_channel_destroy(struct lttng_channel
*channel
);
71 * List the channel(s) of a session.
73 * The handle CAN NOT be NULL.
75 * Return the size (number of entries) of the "lttng_channel" array. Caller
76 * must free channels. On error, a negative LTTng error code is returned.
78 LTTNG_EXPORT
extern int lttng_list_channels(struct lttng_handle
*handle
,
79 struct lttng_channel
**channels
);
82 * Create or enable a channel.
84 * The chan and handle params can not be NULL.
86 * Return 0 on success else a negative LTTng error code.
88 LTTNG_EXPORT
extern int lttng_enable_channel(struct lttng_handle
*handle
,
89 struct lttng_channel
*chan
);
94 * Name and handle CAN NOT be NULL.
96 * Return 0 on success else a negative LTTng error code.
98 LTTNG_EXPORT
extern int lttng_disable_channel(struct lttng_handle
*handle
,
102 * Set the default channel attributes for a specific domain and an allocated
103 * lttng_channel_attr pointer.
105 * If one or both arguments are NULL, nothing happens.
107 LTTNG_EXPORT
extern void lttng_channel_set_default_attr(struct lttng_domain
*domain
,
108 struct lttng_channel_attr
*attr
);
111 * Get the discarded event count of a specific LTTng channel.
113 * Returns 0 on success, or a negative LTTng error code on error.
115 LTTNG_EXPORT
extern int lttng_channel_get_discarded_event_count(struct lttng_channel
*chan
,
116 uint64_t *discarded_events
);
119 * Get the lost packet count of a specific LTTng channel.
121 * Returns 0 on success, or a negative LTTng error code on error.
123 LTTNG_EXPORT
extern int lttng_channel_get_lost_packet_count(struct lttng_channel
*chan
,
124 uint64_t *lost_packets
);
126 LTTNG_EXPORT
extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel
*chan
,
127 uint64_t *monitor_timer_interval
);
129 LTTNG_EXPORT
extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel
*chan
,
130 uint64_t monitor_timer_interval
);
132 LTTNG_EXPORT
extern int lttng_channel_get_blocking_timeout(struct lttng_channel
*chan
,
133 int64_t *blocking_timeout
);
135 LTTNG_EXPORT
extern int lttng_channel_set_blocking_timeout(struct lttng_channel
*chan
,
136 int64_t blocking_timeout
);
142 #endif /* LTTNG_CHANNEL_H */