docs: Add supported versions and fix-backport policy
[lttng-tools.git] / include / lttng / channel.h
1 /*
2 * Copyright (C) 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
18 extern "C" {
19 #endif
20
21 /*
22 * Tracer channel attributes. For both kernel and user-space.
23 *
24 * The structures should be initialized to zero before use.
25 */
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 */
40 uint32_t align_to_64;
41 union {
42 uint64_t padding;
43 void *ptr;
44 } extended;
45
46 char padding[LTTNG_CHANNEL_ATTR_PADDING1];
47 };
48
49 /*
50 * Channel information structure. For both kernel and user-space.
51 *
52 * The structures should be initialized to zero before use.
53 */
54 #define LTTNG_CHANNEL_PADDING1 16
55 struct lttng_channel {
56 char name[LTTNG_SYMBOL_NAME_LEN];
57 uint32_t enabled;
58 struct lttng_channel_attr attr;
59
60 char padding[LTTNG_CHANNEL_PADDING1];
61 };
62
63 /*
64 */
65 LTTNG_EXPORT extern struct lttng_channel *lttng_channel_create(struct lttng_domain *domain);
66
67 /*
68 */
69 LTTNG_EXPORT extern void lttng_channel_destroy(struct lttng_channel *channel);
70
71 /*
72 * List the channel(s) of a session.
73 *
74 * The handle CAN NOT be NULL.
75 *
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.
78 */
79 LTTNG_EXPORT extern int lttng_list_channels(struct lttng_handle *handle,
80 struct lttng_channel **channels);
81
82 /*
83 * Create or enable a channel.
84 *
85 * The chan and handle params can not be NULL.
86 *
87 * Return 0 on success else a negative LTTng error code.
88 */
89 LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle,
90 struct lttng_channel *chan);
91
92 /*
93 * Disable channel.
94 *
95 * Name and handle CAN NOT be NULL.
96 *
97 * Return 0 on success else a negative LTTng error code.
98 */
99 LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle, const char *name);
100
101 /*
102 * Set the default channel attributes for a specific domain and an allocated
103 * lttng_channel_attr pointer.
104 *
105 * If one or both arguments are NULL, nothing happens.
106 */
107 LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *domain,
108 struct lttng_channel_attr *attr);
109
110 /*
111 * Get the discarded event count of a specific LTTng channel.
112 *
113 * Returns 0 on success, or a negative LTTng error code on error.
114 */
115 LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan,
116 uint64_t *discarded_events);
117
118 /*
119 * Get the lost packet count of a specific LTTng channel.
120 *
121 * Returns 0 on success, or a negative LTTng error code on error.
122 */
123 LTTNG_EXPORT extern int lttng_channel_get_lost_packet_count(struct lttng_channel *chan,
124 uint64_t *lost_packets);
125
126 LTTNG_EXPORT extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan,
127 uint64_t *monitor_timer_interval);
128
129 LTTNG_EXPORT extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan,
130 uint64_t monitor_timer_interval);
131
132 LTTNG_EXPORT extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan,
133 int64_t *blocking_timeout);
134
135 LTTNG_EXPORT extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan,
136 int64_t blocking_timeout);
137
138 #ifdef __cplusplus
139 }
140 #endif
141
142 #endif /* LTTNG_CHANNEL_H */
This page took 0.031269 seconds and 4 git commands to generate.