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>
20 * Tracer channel attributes. For both kernel and user-space.
22 * The structures should be initialized to zero before use.
24 #define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
25 struct lttng_channel_attr
{
26 int overwrite
; /* -1: session default, 1: overwrite, 0: discard */
27 uint64_t subbuf_size
; /* bytes, power of 2 */
28 uint64_t num_subbuf
; /* power of 2 */
29 unsigned int switch_timer_interval
; /* usec */
30 unsigned int read_timer_interval
; /* usec */
31 enum lttng_event_output output
; /* splice, mmap */
32 /* LTTng 2.1 padding limit */
33 uint64_t tracefile_size
; /* bytes */
34 uint64_t tracefile_count
; /* number of tracefiles */
35 /* LTTng 2.3 padding limit */
36 unsigned int live_timer_interval
; /* usec */
37 /* LTTng 2.7 padding limit */
44 char padding
[LTTNG_CHANNEL_ATTR_PADDING1
];
48 * Channel information structure. For both kernel and user-space.
50 * The structures should be initialized to zero before use.
52 #define LTTNG_CHANNEL_PADDING1 16
53 struct lttng_channel
{
54 char name
[LTTNG_SYMBOL_NAME_LEN
];
56 struct lttng_channel_attr attr
;
58 char padding
[LTTNG_CHANNEL_PADDING1
];
63 extern struct lttng_channel
*lttng_channel_create(struct lttng_domain
*domain
);
67 extern void lttng_channel_destroy(struct lttng_channel
*channel
);
70 * List the channel(s) of a session.
72 * The handle CAN NOT be NULL.
74 * Return the size (number of entries) of the "lttng_channel" array. Caller
75 * must free channels. On error, a negative LTTng error code is returned.
77 extern int lttng_list_channels(struct lttng_handle
*handle
,
78 struct lttng_channel
**channels
);
81 * Create or enable a channel.
83 * The chan and handle params can not be NULL.
85 * Return 0 on success else a negative LTTng error code.
87 extern int lttng_enable_channel(struct lttng_handle
*handle
,
88 struct lttng_channel
*chan
);
93 * Name and handle CAN NOT be NULL.
95 * Return 0 on success else a negative LTTng error code.
97 extern int lttng_disable_channel(struct lttng_handle
*handle
,
101 * Set the default channel attributes for a specific domain and an allocated
102 * lttng_channel_attr pointer.
104 * If one or both arguments are NULL, nothing happens.
106 extern void lttng_channel_set_default_attr(struct lttng_domain
*domain
,
107 struct lttng_channel_attr
*attr
);
110 * Get the discarded event count of a specific LTTng channel.
112 * Returns 0 on success, or a negative LTTng error code on error.
114 extern int lttng_channel_get_discarded_event_count(struct lttng_channel
*chan
,
115 uint64_t *discarded_events
);
118 * Get the lost packet count of a specific LTTng channel.
120 * Returns 0 on success, or a negative LTTng error code on error.
122 extern int lttng_channel_get_lost_packet_count(struct lttng_channel
*chan
,
123 uint64_t *lost_packets
);
125 extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel
*chan
,
126 uint64_t *monitor_timer_interval
);
128 extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel
*chan
,
129 uint64_t monitor_timer_interval
);
131 extern int lttng_channel_get_blocking_timeout(struct lttng_channel
*chan
,
132 int64_t *blocking_timeout
);
134 extern int lttng_channel_set_blocking_timeout(struct lttng_channel
*chan
,
135 int64_t blocking_timeout
);
141 #endif /* LTTNG_CHANNEL_H */