Commit | Line | Data |
---|---|---|
99054cee PMF |
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> | |
59b161cd PMF |
11 | //ust// #include <linux/kref.h> |
12 | //ust// #include <linux/list.h> | |
b6bf28ec | 13 | #include <errno.h> |
59b161cd | 14 | |
b6bf28ec PMF |
15 | #include "kernelcompat.h" |
16 | #include "kref.h" | |
99054cee PMF |
17 | |
18 | #define EVENTS_PER_CHANNEL 65536 | |
19 | ||
20 | struct ltt_trace_struct; | |
21 | struct rchan_buf; | |
22 | ||
23 | struct ltt_channel_struct { | |
24 | /* First 32 bytes cache-hot cacheline */ | |
25 | struct ltt_trace_struct *trace; | |
26 | void *buf; | |
27 | void *trans_channel_data; | |
28 | int overwrite:1; | |
29 | int active:1; | |
30 | unsigned int n_subbufs_order; | |
31 | unsigned long commit_count_mask; /* | |
32 | * Commit count mask, removing | |
33 | * the MSBs corresponding to | |
34 | * bits used to represent the | |
35 | * subbuffer index. | |
36 | */ | |
37 | /* End of first 32 bytes cacheline */ | |
38 | ||
39 | /* | |
40 | * buffer_begin - called on buffer-switch to a new sub-buffer | |
41 | * @buf: the channel buffer containing the new sub-buffer | |
42 | */ | |
43 | void (*buffer_begin) (struct rchan_buf *buf, | |
44 | u64 tsc, unsigned int subbuf_idx); | |
45 | /* | |
46 | * buffer_end - called on buffer-switch to a new sub-buffer | |
47 | * @buf: the channel buffer containing the previous sub-buffer | |
48 | */ | |
49 | void (*buffer_end) (struct rchan_buf *buf, | |
50 | u64 tsc, unsigned int offset, unsigned int subbuf_idx); | |
51 | struct kref kref; /* Channel transport reference count */ | |
52 | unsigned int subbuf_size; | |
53 | unsigned int subbuf_cnt; | |
54 | const char *channel_name; | |
8cefc145 PMF |
55 | |
56 | int buf_shmid; | |
99054cee PMF |
57 | } ____cacheline_aligned; |
58 | ||
59 | struct ltt_channel_setting { | |
60 | unsigned int subbuf_size; | |
61 | unsigned int subbuf_cnt; | |
62 | struct kref kref; /* Number of references to structure content */ | |
63 | struct list_head list; | |
64 | unsigned int index; /* index of channel in trace channel array */ | |
65 | u16 free_event_id; /* Next event ID to allocate */ | |
66 | char name[PATH_MAX]; | |
67 | }; | |
68 | ||
69 | int ltt_channels_register(const char *name); | |
70 | int ltt_channels_unregister(const char *name); | |
71 | int ltt_channels_set_default(const char *name, | |
72 | unsigned int subbuf_size, | |
73 | unsigned int subbuf_cnt); | |
74 | const char *ltt_channels_get_name_from_index(unsigned int index); | |
75 | int ltt_channels_get_index_from_name(const char *name); | |
76 | struct ltt_channel_struct *ltt_channels_trace_alloc(unsigned int *nr_channels, | |
77 | int overwrite, | |
78 | int active); | |
79 | void ltt_channels_trace_free(struct ltt_channel_struct *channels); | |
80 | int _ltt_channels_get_event_id(const char *channel, const char *name); | |
81 | int ltt_channels_get_event_id(const char *channel, const char *name); | |
82 | ||
83 | #endif /* _LTT_CHANNELS_H */ |