ust: continue work
[ust.git] / libtracing / channels.h
1 #ifndef _LTT_CHANNELS_H
2 #define _LTT_CHANNELS_H
3
4 /*
5 * Copyright (C) 2008 Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
6 *
7 * Dynamic tracer channel allocation.
8 */
9
10 #include <linux/limits.h>
11 //ust// #include <linux/kref.h>
12 //ust// #include <linux/list.h>
13 #include <kernelcompat.h>
14
15 #include <kref.h>
16
17 #define EVENTS_PER_CHANNEL 65536
18
19 struct ltt_trace_struct;
20 struct rchan_buf;
21
22 struct ltt_channel_struct {
23 /* First 32 bytes cache-hot cacheline */
24 struct ltt_trace_struct *trace;
25 void *buf;
26 void *trans_channel_data;
27 int overwrite:1;
28 int active:1;
29 unsigned int n_subbufs_order;
30 unsigned long commit_count_mask; /*
31 * Commit count mask, removing
32 * the MSBs corresponding to
33 * bits used to represent the
34 * subbuffer index.
35 */
36 /* End of first 32 bytes cacheline */
37
38 /*
39 * buffer_begin - called on buffer-switch to a new sub-buffer
40 * @buf: the channel buffer containing the new sub-buffer
41 */
42 void (*buffer_begin) (struct rchan_buf *buf,
43 u64 tsc, unsigned int subbuf_idx);
44 /*
45 * buffer_end - called on buffer-switch to a new sub-buffer
46 * @buf: the channel buffer containing the previous sub-buffer
47 */
48 void (*buffer_end) (struct rchan_buf *buf,
49 u64 tsc, unsigned int offset, unsigned int subbuf_idx);
50 struct kref kref; /* Channel transport reference count */
51 unsigned int subbuf_size;
52 unsigned int subbuf_cnt;
53 const char *channel_name;
54 } ____cacheline_aligned;
55
56 struct ltt_channel_setting {
57 unsigned int subbuf_size;
58 unsigned int subbuf_cnt;
59 struct kref kref; /* Number of references to structure content */
60 struct list_head list;
61 unsigned int index; /* index of channel in trace channel array */
62 u16 free_event_id; /* Next event ID to allocate */
63 char name[PATH_MAX];
64 };
65
66 int ltt_channels_register(const char *name);
67 int ltt_channels_unregister(const char *name);
68 int ltt_channels_set_default(const char *name,
69 unsigned int subbuf_size,
70 unsigned int subbuf_cnt);
71 const char *ltt_channels_get_name_from_index(unsigned int index);
72 int ltt_channels_get_index_from_name(const char *name);
73 struct ltt_channel_struct *ltt_channels_trace_alloc(unsigned int *nr_channels,
74 int overwrite,
75 int active);
76 void ltt_channels_trace_free(struct ltt_channel_struct *channels);
77 int _ltt_channels_get_event_id(const char *channel, const char *name);
78 int ltt_channels_get_event_id(const char *channel, const char *name);
79
80 #endif /* _LTT_CHANNELS_H */
This page took 0.039406 seconds and 5 git commands to generate.