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
;
19 /* Type description */
21 /* Update the astract_types name table in lttng-types.c along with this enum */
31 /* Update the string_encodings name table in lttng-types.c along with this enum */
32 enum lttng_string_encodings
{
33 lttng_encode_UTF8
= 0,
34 lttng_encode_ASCII
= 1,
38 struct lttng_enum_entry
{
39 unsigned long long start
, end
; /* start and end are inclusive */
44 const struct lttng_enum_entry
*entries
;
49 enum abstract_types atype
;
53 unsigned int size
; /* in bits */
54 unsigned short alignment
; /* in bits */
55 unsigned int signedness
:1;
56 unsigned int reverse_byte_order
:1;
59 const char *parent_type
;
60 const struct lttng_enum def
;
63 const char *elem_type
;
64 unsigned int length
; /* num. elems. */
67 const char *elem_type
;
68 const char *length_type
;
71 enum lttng_string_encodings encoding
;
74 } __attribute__((packed
));
76 /* Event field description */
78 struct lttng_event_field
{
80 const struct lttng_type type
;
83 struct lttng_event_desc
{
84 const struct lttng_event_field
*fields
;
87 unsigned int nr_fields
;
90 struct lttng_probe_desc
{
91 const struct lttng_event_desc
*event_desc
;
92 unsigned int nr_events
;
93 struct list_head head
; /* chain registered probes */
97 * ltt_event structure is referred to by the tracing fast path. It must be
102 struct ltt_channel
*chan
;
103 const struct lttng_event_desc
*desc
;
105 enum instrum_type itype
;
106 struct list_head list
; /* Event list */
109 struct ltt_channel_ops
{
110 struct channel
*(*channel_create
)(const char *name
,
111 struct ltt_session
*session
,
113 size_t subbuf_size
, size_t num_subbuf
,
114 unsigned int switch_timer_interval
,
115 unsigned int read_timer_interval
);
116 void (*channel_destroy
)(struct channel
*chan
);
117 struct lib_ring_buffer
*(*buffer_read_open
)(struct channel
*chan
);
118 void (*buffer_read_close
)(struct lib_ring_buffer
*buf
);
119 int (*event_reserve
)(struct lib_ring_buffer_ctx
*ctx
);
120 void (*event_commit
)(struct lib_ring_buffer_ctx
*ctx
);
121 void (*event_write
)(struct lib_ring_buffer_ctx
*ctx
, const void *src
,
126 struct channel
*chan
; /* Channel buffers */
127 /* Event ID management */
128 struct ltt_session
*session
;
129 struct file
*file
; /* File associated to channel */
130 unsigned int free_event_id
; /* Next event ID to allocate */
131 struct list_head list
; /* Channel list */
132 wait_queue_head_t notify_wait
; /* Channel addition notif. waitqueue */
133 struct ltt_channel_ops
*ops
;
137 int active
; /* Is trace session active ? */
138 struct file
*file
; /* File associated to session */
139 struct list_head chan
; /* Channel list head */
140 struct list_head events
; /* Event list head */
141 struct list_head list
; /* Session list */
144 struct ltt_transport
{
146 struct module
*owner
;
147 struct list_head node
;
148 struct ltt_channel_ops ops
;
151 struct ltt_session
*ltt_session_create(void);
152 int ltt_session_start(struct ltt_session
*session
);
153 int ltt_session_stop(struct ltt_session
*session
);
154 void ltt_session_destroy(struct ltt_session
*session
);
156 struct ltt_channel
*ltt_channel_create(struct ltt_session
*session
,
157 const char *transport_name
,
159 size_t subbuf_size
, size_t num_subbuf
,
160 unsigned int switch_timer_interval
,
161 unsigned int read_timer_interval
);
162 struct ltt_channel
*ltt_global_channel_create(struct ltt_session
*session
,
163 int overwrite
, void *buf_addr
,
164 size_t subbuf_size
, size_t num_subbuf
,
165 unsigned int switch_timer_interval
,
166 unsigned int read_timer_interval
);
167 void _ltt_channel_destroy(struct ltt_channel
*chan
);
169 struct ltt_event
*ltt_event_create(struct ltt_channel
*chan
,
171 enum instrum_type itype
,
172 const struct lttng_event_desc
*event_desc
,
174 int _ltt_event_unregister(struct ltt_event
*event
);
175 void _ltt_event_destroy(struct ltt_event
*event
);
177 void ltt_transport_register(struct ltt_transport
*transport
);
178 void ltt_transport_unregister(struct ltt_transport
*transport
);
180 int ltt_debugfs_abi_init(void);
181 void ltt_debugfs_abi_exit(void);
183 int ltt_probe_register(struct lttng_probe_desc
*desc
);
184 void ltt_probe_unregister(struct lttng_probe_desc
*desc
);
185 const struct lttng_event_desc
*ltt_event_get(const char *name
);
186 void ltt_event_put(const struct lttng_event_desc
*desc
);
188 #endif /* _LTT_EVENTS_H */