7 * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Holds LTTng per-session event registry.
12 #include <linux/list.h>
13 #include "ltt-debugfs-abi.h"
17 struct lib_ring_buffer_ctx
;
20 * ltt_event structure is referred to by the tracing fast path. It must be
25 struct ltt_channel
*chan
;
29 enum instrum_type itype
;
30 struct list_head list
; /* Event list */
33 struct ltt_channel_ops
{
34 struct channel
*(*channel_create
)(const char *name
,
35 struct ltt_session
*session
,
37 size_t subbuf_size
, size_t num_subbuf
,
38 unsigned int switch_timer_interval
,
39 unsigned int read_timer_interval
);
40 void (*channel_destroy
)(struct channel
*chan
);
41 struct lib_ring_buffer
*(*buffer_read_open
)(struct channel
*chan
);
42 void (*buffer_read_close
)(struct lib_ring_buffer
*buf
);
43 int (*event_reserve
)(struct lib_ring_buffer_ctx
*ctx
);
44 void (*event_commit
)(struct lib_ring_buffer_ctx
*ctx
);
45 void (*event_write
)(struct lib_ring_buffer_ctx
*ctx
, const void *src
,
50 struct channel
*chan
; /* Channel buffers */
51 /* Event ID management */
52 struct ltt_session
*session
;
53 struct file
*file
; /* File associated to channel */
54 unsigned int free_event_id
; /* Next event ID to allocate */
55 struct list_head list
; /* Channel list */
56 wait_queue_head_t notify_wait
; /* Channel addition notif. waitqueue */
57 struct ltt_channel_ops
*ops
;
61 int active
; /* Is trace session active ? */
62 struct file
*file
; /* File associated to session */
63 struct list_head chan
; /* Channel list head */
64 struct list_head events
; /* Event list head */
65 struct list_head list
; /* Session list */
68 struct ltt_transport
{
71 struct list_head node
;
72 struct ltt_channel_ops ops
;
75 /* Type description */
77 /* Update the astract_types name table in lttng-types.c along with this enum */
87 /* Update the string_encodings name table in lttng-types.c along with this enum */
88 enum lttng_string_encodings
{
89 lttng_encode_UTF8
= 0,
90 lttng_encode_ASCII
= 1,
94 struct lttng_enum_entry
{
95 unsigned long long start
, end
; /* start and end are inclusive */
100 const struct lttng_enum_entry
*entries
;
105 enum abstract_types atype
;
109 unsigned int size
; /* in bits */
110 unsigned short alignment
; /* in bits */
111 unsigned int signedness
:1;
112 unsigned int reverse_byte_order
:1;
115 const char *parent_type
;
116 const struct lttng_enum def
;
119 const char *elem_type
;
120 unsigned int length
; /* num. elems. */
123 const char *elem_type
;
124 const char *length_type
;
127 enum lttng_string_encodings encoding
;
130 } __attribute__((packed
));
132 /* Event field description */
134 struct lttng_event_field
{
136 const struct lttng_type type
;
139 struct lttng_event_desc
{
140 const struct lttng_event_field
*fields
;
142 void *probe_callback
;
143 unsigned int nr_fields
;
146 struct ltt_session
*ltt_session_create(void);
147 int ltt_session_start(struct ltt_session
*session
);
148 int ltt_session_stop(struct ltt_session
*session
);
149 void ltt_session_destroy(struct ltt_session
*session
);
151 struct ltt_channel
*ltt_channel_create(struct ltt_session
*session
,
152 const char *transport_name
,
154 size_t subbuf_size
, size_t num_subbuf
,
155 unsigned int switch_timer_interval
,
156 unsigned int read_timer_interval
);
157 struct ltt_channel
*ltt_global_channel_create(struct ltt_session
*session
,
158 int overwrite
, void *buf_addr
,
159 size_t subbuf_size
, size_t num_subbuf
,
160 unsigned int switch_timer_interval
,
161 unsigned int read_timer_interval
);
162 void _ltt_channel_destroy(struct ltt_channel
*chan
);
164 struct ltt_event
*ltt_event_create(struct ltt_channel
*chan
,
166 enum instrum_type itype
,
167 void *probe
, void *filter
);
168 int _ltt_event_unregister(struct ltt_event
*event
);
169 void _ltt_event_destroy(struct ltt_event
*event
);
171 void ltt_transport_register(struct ltt_transport
*transport
);
172 void ltt_transport_unregister(struct ltt_transport
*transport
);
174 int ltt_debugfs_abi_init(void);
175 void ltt_debugfs_abi_exit(void);
177 int ltt_probe_register(const char *name
, void *cb
);
178 void ltt_probe_unregister(const char *name
);
179 void *ltt_probe_get(const char *name
);
180 void ltt_probe_put(void *cb
);
181 int ltt_probes_init(void);
182 void ltt_probes_exit(void);
184 #endif /* _LTT_EVENTS_H */