Rename for the new liburcu API namespace
[lttng-ust.git] / libust / channels.h
1 #ifndef UST_CHANNELS_H
2 #define UST_CHANNELS_H
3
4 /*
5 * Copyright (C) 2008 Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
6 *
7 * Dynamic tracer channel allocation.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #include <linux/limits.h>
25 #include <errno.h>
26 #include <ust/kcompat/kcompat.h>
27 #include <urcu/list.h>
28 #include <ust/core.h>
29
30 #define EVENTS_PER_CHANNEL 65536
31 #define MAX_CPUS 32
32
33 struct ust_trace;
34
35 struct ust_buffer;
36
37 struct ust_channel {
38 /* First 32 bytes cache-hot cacheline */
39 struct ust_trace *trace;
40 int *buf_struct_shmids;
41 struct ust_buffer **buf;
42 int overwrite:1;
43 /* whether collection is requested upon trace start */
44 int request_collection:1;
45 int active:1;
46 unsigned int n_subbufs_order;
47 unsigned long commit_count_mask; /*
48 * Commit count mask, removing
49 * the MSBs corresponding to
50 * bits used to represent the
51 * subbuffer index.
52 */
53 /* End of first 32 bytes cacheline */
54
55 struct kref kref; /* Channel transport reference count */
56 size_t subbuf_size;
57 int subbuf_size_order;
58 unsigned int subbuf_cnt;
59 const char *channel_name;
60 int n_cpus;
61
62 u32 version;
63 size_t alloc_size;
64 struct cds_list_head list;
65 } ____cacheline_aligned;
66
67 struct ltt_channel_setting {
68 unsigned int subbuf_size;
69 unsigned int subbuf_cnt;
70 struct kref kref; /* Number of references to structure content */
71 struct cds_list_head list;
72 unsigned int index; /* index of channel in trace channel array */
73 u16 free_event_id; /* Next event ID to allocate */
74 char name[PATH_MAX];
75 };
76
77 extern int ltt_channels_register(const char *name);
78 extern int ltt_channels_unregister(const char *name);
79 extern int ltt_channels_set_default(const char *name,
80 unsigned int subbuf_size,
81 unsigned int subbuf_cnt);
82 extern const char *ltt_channels_get_name_from_index(unsigned int index);
83 extern int ltt_channels_get_index_from_name(const char *name);
84 extern struct ust_channel *ltt_channels_trace_alloc(unsigned int *nr_channels,
85 int overwrite,
86 int request_collection,
87 int active);
88 extern void ltt_channels_trace_free(struct ust_channel *channels);
89 extern int _ltt_channels_get_event_id(const char *channel, const char *name);
90 extern int ltt_channels_get_event_id(const char *channel, const char *name);
91
92 extern int ust_channels_overwrite_by_default;
93 extern int ust_channels_request_collection_by_default;
94
95 #endif /* UST_CHANNELS_H */
This page took 0.035533 seconds and 4 git commands to generate.