5 * Copyright (C) 2008 Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
7 * Dynamic tracer channel allocation.
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.
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.
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
24 #include <linux/limits.h>
27 #include <ust/kernelcompat.h>
29 #define EVENTS_PER_CHANNEL 65536
37 /* First 32 bytes cache-hot cacheline */
38 struct ust_trace
*trace
;
39 int *buf_struct_shmids
;
40 struct ust_buffer
**buf
;
42 /* whether collection is requested upon trace start */
43 int request_collection
:1;
45 unsigned int n_subbufs_order
;
46 unsigned long commit_count_mask
; /*
47 * Commit count mask, removing
48 * the MSBs corresponding to
49 * bits used to represent the
52 /* End of first 32 bytes cacheline */
54 struct kref kref
; /* Channel transport reference count */
56 int subbuf_size_order
;
57 unsigned int subbuf_cnt
;
58 const char *channel_name
;
63 struct list_head list
;
64 } ____cacheline_aligned
;
66 struct ltt_channel_setting
{
67 unsigned int subbuf_size
;
68 unsigned int subbuf_cnt
;
69 struct kref kref
; /* Number of references to structure content */
70 struct list_head list
;
71 unsigned int index
; /* index of channel in trace channel array */
72 u16 free_event_id
; /* Next event ID to allocate */
76 extern int ltt_channels_register(const char *name
);
77 extern int ltt_channels_unregister(const char *name
);
78 extern int ltt_channels_set_default(const char *name
,
79 unsigned int subbuf_size
,
80 unsigned int subbuf_cnt
);
81 extern const char *ltt_channels_get_name_from_index(unsigned int index
);
82 extern int ltt_channels_get_index_from_name(const char *name
);
83 extern struct ust_channel
*ltt_channels_trace_alloc(unsigned int *nr_channels
,
85 int request_collection
,
87 extern void ltt_channels_trace_free(struct ust_channel
*channels
);
88 extern int _ltt_channels_get_event_id(const char *channel
, const char *name
);
89 extern int ltt_channels_get_event_id(const char *channel
, const char *name
);
91 extern int ust_channels_overwrite_by_default
;
92 extern int ust_channels_request_collection_by_default
;
94 #endif /* UST_CHANNELS_H */