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