libust: New transport mutex v2
[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 <ust/core.h>
28
29 #define _LGPL_SOURCE
30 #include <urcu/list.h>
31 #include <urcu/urcu_ref.h>
32
33 #define EVENTS_PER_CHANNEL 65536
34 #define MAX_CPUS 32
35
36 struct ust_trace;
37
38 struct ust_buffer;
39
40 struct ust_channel {
41 /* First 32 bytes cache-hot cacheline */
42 struct ust_trace *trace;
43 int *buf_struct_shmids;
44 struct ust_buffer **buf;
45 int overwrite:1;
46 /* whether collection is requested upon trace start */
47 int request_collection:1;
48 int active:1;
49 unsigned int n_subbufs_order;
50 unsigned long commit_count_mask; /*
51 * Commit count mask, removing
52 * the MSBs corresponding to
53 * bits used to represent the
54 * subbuffer index.
55 */
56 /* End of first 32 bytes cacheline */
57
58 struct urcu_ref urcu_ref; /* Channel transport reference count */
59 size_t subbuf_size;
60 int subbuf_size_order;
61 unsigned int subbuf_cnt;
62 const char *channel_name;
63 int n_cpus;
64
65 u32 version;
66 size_t alloc_size;
67 struct cds_list_head list;
68 } ____cacheline_aligned;
69
70 struct ltt_channel_setting {
71 unsigned int subbuf_size;
72 unsigned int subbuf_cnt;
73 struct urcu_ref urcu_ref; /* Number of references to structure content */
74 struct cds_list_head list;
75 unsigned int index; /* index of channel in trace channel array */
76 u16 free_event_id; /* Next event ID to allocate */
77 char name[PATH_MAX];
78 };
79
80 extern int ltt_channels_register(const char *name);
81 extern int ltt_channels_unregister(const char *name);
82 extern int ltt_channels_set_default(const char *name,
83 unsigned int subbuf_size,
84 unsigned int subbuf_cnt);
85 extern const char *ltt_channels_get_name_from_index(unsigned int index);
86 extern int ltt_channels_get_index_from_name(const char *name);
87 extern struct ust_channel *ltt_channels_trace_alloc(unsigned int *nr_channels,
88 int overwrite,
89 int request_collection,
90 int active);
91 extern void ltt_channels_trace_free(struct ust_channel *channels);
92 extern int _ltt_channels_get_event_id(const char *channel, const char *name);
93 extern int ltt_channels_get_event_id(const char *channel, const char *name);
94
95 extern int ust_channels_overwrite_by_default;
96 extern int ust_channels_request_collection_by_default;
97
98 #endif /* UST_CHANNELS_H */
This page took 0.031308 seconds and 4 git commands to generate.