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.
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 15#include "kernelcompat.h"
79d4d545 16#include <kcompat/kref.h>
99054cee
PMF
17
18#define EVENTS_PER_CHANNEL 65536
19
20struct ltt_trace_struct;
21struct rchan_buf;
22
23struct 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
59struct 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
69int ltt_channels_register(const char *name);
70int ltt_channels_unregister(const char *name);
71int ltt_channels_set_default(const char *name,
72 unsigned int subbuf_size,
73 unsigned int subbuf_cnt);
74const char *ltt_channels_get_name_from_index(unsigned int index);
75int ltt_channels_get_index_from_name(const char *name);
76struct ltt_channel_struct *ltt_channels_trace_alloc(unsigned int *nr_channels,
77 int overwrite,
78 int active);
79void ltt_channels_trace_free(struct ltt_channel_struct *channels);
80int _ltt_channels_get_event_id(const char *channel, const char *name);
81int ltt_channels_get_event_id(const char *channel, const char *name);
82
83#endif /* _LTT_CHANNELS_H */
This page took 0.025371 seconds and 4 git commands to generate.