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