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