e770f6835a491f35c3dbdea7b4705ad65afefbdc
[lttng-tools.git] / include / lttng / channel.h
1 /*
2 * Copyright (C) 2014 - David Goulet <dgoulet@efficios.com>
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18 #ifndef LTTNG_CHANNEL_H
19 #define LTTNG_CHANNEL_H
20
21 #include <lttng/domain.h>
22 #include <lttng/event.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /*
29 * Tracer channel attributes. For both kernel and user-space.
30 *
31 * The structures should be initialized to zero before use.
32 */
33 #define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
34 struct lttng_channel_attr {
35 int overwrite; /* 1: overwrite, 0: discard */
36 uint64_t subbuf_size; /* bytes, power of 2 */
37 uint64_t num_subbuf; /* power of 2 */
38 unsigned int switch_timer_interval; /* usec */
39 unsigned int read_timer_interval; /* usec */
40 enum lttng_event_output output; /* splice, mmap */
41 /* LTTng 2.1 padding limit */
42 uint64_t tracefile_size; /* bytes */
43 uint64_t tracefile_count; /* number of tracefiles */
44 /* LTTng 2.3 padding limit */
45 unsigned int live_timer_interval; /* usec */
46 /* LTTng 2.7 padding limit */
47 uint32_t align_to_64;
48 union {
49 uint64_t padding;
50 void *ptr;
51 } extended;
52
53 char padding[LTTNG_CHANNEL_ATTR_PADDING1];
54 };
55
56 /*
57 * Channel information structure. For both kernel and user-space.
58 *
59 * The structures should be initialized to zero before use.
60 */
61 #define LTTNG_CHANNEL_PADDING1 16
62 struct lttng_channel {
63 char name[LTTNG_SYMBOL_NAME_LEN];
64 uint32_t enabled;
65 struct lttng_channel_attr attr;
66
67 char padding[LTTNG_CHANNEL_PADDING1];
68 };
69
70 /*
71 * List the channel(s) of a session.
72 *
73 * The handle CAN NOT be NULL.
74 *
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.
77 */
78 extern int lttng_list_channels(struct lttng_handle *handle,
79 struct lttng_channel **channels);
80
81 /*
82 * Create or enable a channel.
83 *
84 * The chan and handle params can not be NULL.
85 *
86 * Return 0 on success else a negative LTTng error code.
87 */
88 extern int lttng_enable_channel(struct lttng_handle *handle,
89 struct lttng_channel *chan);
90
91 /*
92 * Disable channel.
93 *
94 * Name and handle CAN NOT be NULL.
95 *
96 * Return 0 on success else a negative LTTng error code.
97 */
98 extern int lttng_disable_channel(struct lttng_handle *handle,
99 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 extern void lttng_channel_set_default_attr(struct lttng_domain *domain,
108 struct lttng_channel_attr *attr);
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif /* LTTNG_CHANNEL_H */
This page took 0.030791 seconds and 3 git commands to generate.