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>
22 * Tracer channel attributes. For both kernel and user-space.
24 * The structures should be initialized to zero before use.
26 #define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
27 struct lttng_channel_attr
{
28 int overwrite
; /* -1: session default, 1: overwrite, 0: discard */
29 uint64_t subbuf_size
; /* bytes, power of 2 */
30 uint64_t num_subbuf
; /* power of 2 */
31 unsigned int switch_timer_interval
; /* usec */
32 unsigned int read_timer_interval
; /* usec */
33 enum lttng_event_output output
; /* splice, mmap */
34 /* LTTng 2.1 padding limit */
35 uint64_t tracefile_size
; /* bytes */
36 uint64_t tracefile_count
; /* number of tracefiles */
37 /* LTTng 2.3 padding limit */
38 unsigned int live_timer_interval
; /* usec */
39 /* LTTng 2.7 padding limit */
46 char padding
[LTTNG_CHANNEL_ATTR_PADDING1
];
50 * Channel information structure. For both kernel and user-space.
52 * The structures should be initialized to zero before use.
54 #define LTTNG_CHANNEL_PADDING1 16
55 struct lttng_channel
{
56 char name
[LTTNG_SYMBOL_NAME_LEN
];
58 struct lttng_channel_attr attr
;
60 char padding
[LTTNG_CHANNEL_PADDING1
];
65 LTTNG_EXPORT
extern struct lttng_channel
*lttng_channel_create(struct lttng_domain
*domain
);
69 LTTNG_EXPORT
extern void lttng_channel_destroy(struct lttng_channel
*channel
);
72 * List the channel(s) of a session.
74 * The handle CAN NOT be NULL.
76 * Return the size (number of entries) of the "lttng_channel" array. Caller
77 * must free channels. On error, a negative LTTng error code is returned.
79 LTTNG_EXPORT
extern int lttng_list_channels(struct lttng_handle
*handle
,
80 struct lttng_channel
**channels
);
83 * Create or enable a channel.
85 * The chan and handle params can not be NULL.
87 * Return 0 on success else a negative LTTng error code.
89 LTTNG_EXPORT
extern int lttng_enable_channel(struct lttng_handle
*handle
,
90 struct lttng_channel
*chan
);
95 * Name and handle CAN NOT be NULL.
97 * Return 0 on success else a negative LTTng error code.
99 LTTNG_EXPORT
extern int lttng_disable_channel(struct lttng_handle
*handle
, const char *name
);
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 */