Use -EIO as tsc value for nmi error (and drop event)
[lttng-modules.git] / ltt-events.h
CommitLineData
11b5a3c2
MD
1#ifndef _LTT_EVENTS_H
2#define _LTT_EVENTS_H
3
4e3c1b9b
MD
4/*
5 * ltt-events.h
6 *
7 * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * Holds LTTng per-session event registry.
10 */
11
12#include <linux/list.h>
11b5a3c2 13#include "ltt-debugfs-abi.h"
4e3c1b9b
MD
14
15struct ltt_channel;
16struct ltt_session;
1c25284c 17struct lib_ring_buffer_ctx;
4e3c1b9b 18
c0edae1d
MD
19/* Type description */
20
21/* Update the astract_types name table in lttng-types.c along with this enum */
22enum abstract_types {
23 atype_integer,
24 atype_enum,
25 atype_array,
26 atype_sequence,
27 atype_string,
28 NR_ABSTRACT_TYPES,
29};
30
31/* Update the string_encodings name table in lttng-types.c along with this enum */
32enum lttng_string_encodings {
33 lttng_encode_UTF8 = 0,
34 lttng_encode_ASCII = 1,
35 NR_STRING_ENCODINGS,
36};
37
38struct lttng_enum_entry {
39 unsigned long long start, end; /* start and end are inclusive */
40 const char *string;
41};
42
43struct lttng_enum {
44 const struct lttng_enum_entry *entries;
45 unsigned int len;
46};
47
48struct lttng_type {
49 enum abstract_types atype;
50 const char *name;
51 union {
52 struct {
53 unsigned int size; /* in bits */
54 unsigned short alignment; /* in bits */
55 unsigned int signedness:1;
56 unsigned int reverse_byte_order:1;
57 } integer;
58 struct {
59 const char *parent_type;
60 const struct lttng_enum def;
61 } enumeration;
62 struct {
63 const char *elem_type;
64 unsigned int length; /* num. elems. */
65 } array;
66 struct {
67 const char *elem_type;
68 const char *length_type;
69 } sequence;
70 struct {
71 enum lttng_string_encodings encoding;
72 } string;
73 } u;
74} __attribute__((packed));
75
76/* Event field description */
77
78struct lttng_event_field {
79 const char *name;
80 const struct lttng_type type;
81};
82
83struct lttng_event_desc {
84 const struct lttng_event_field *fields;
85 const char *name;
86 void *probe_callback;
87 unsigned int nr_fields;
88};
89
85a9ca7f
MD
90struct lttng_probe_desc {
91 const struct lttng_event_desc *event_desc;
92 unsigned int nr_events;
93 struct list_head head; /* chain registered probes */
94};
95
96/*
97 * ltt_event structure is referred to by the tracing fast path. It must be
98 * kept small.
99 */
100struct ltt_event {
101 unsigned int id;
102 struct ltt_channel *chan;
103 const struct lttng_event_desc *desc;
104 void *filter;
105 enum instrum_type itype;
106 struct list_head list; /* Event list */
107};
108
109struct ltt_channel_ops {
110 struct channel *(*channel_create)(const char *name,
111 struct ltt_session *session,
112 void *buf_addr,
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,
122 size_t len);
123};
124
125struct ltt_channel {
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;
134};
135
136struct ltt_session {
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 */
142};
143
144struct ltt_transport {
145 char *name;
146 struct module *owner;
147 struct list_head node;
148 struct ltt_channel_ops ops;
149};
150
baf20995 151struct ltt_session *ltt_session_create(void);
c0e31d2e
MD
152int ltt_session_start(struct ltt_session *session);
153int ltt_session_stop(struct ltt_session *session);
11b5a3c2 154void ltt_session_destroy(struct ltt_session *session);
4e3c1b9b 155
baf20995 156struct ltt_channel *ltt_channel_create(struct ltt_session *session,
5dbbdb43
MD
157 const char *transport_name,
158 void *buf_addr,
159 size_t subbuf_size, size_t num_subbuf,
160 unsigned int switch_timer_interval,
161 unsigned int read_timer_interval);
162struct ltt_channel *ltt_global_channel_create(struct ltt_session *session,
4e3c1b9b
MD
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);
11b5a3c2 167void _ltt_channel_destroy(struct ltt_channel *chan);
4e3c1b9b 168
653fe716 169struct ltt_event *ltt_event_create(struct ltt_channel *chan,
653fe716 170 char *name,
11b5a3c2 171 enum instrum_type itype,
85a9ca7f
MD
172 const struct lttng_event_desc *event_desc,
173 void *filter);
dda6a249
MD
174int _ltt_event_unregister(struct ltt_event *event);
175void _ltt_event_destroy(struct ltt_event *event);
c0e31d2e
MD
176
177void ltt_transport_register(struct ltt_transport *transport);
178void ltt_transport_unregister(struct ltt_transport *transport);
11b5a3c2 179
1c25284c
MD
180int ltt_debugfs_abi_init(void);
181void ltt_debugfs_abi_exit(void);
182
85a9ca7f
MD
183int ltt_probe_register(struct lttng_probe_desc *desc);
184void ltt_probe_unregister(struct lttng_probe_desc *desc);
185const struct lttng_event_desc *ltt_event_get(const char *name);
186void ltt_event_put(const struct lttng_event_desc *desc);
02119ee5 187
11b5a3c2 188#endif /* _LTT_EVENTS_H */
This page took 0.029902 seconds and 4 git commands to generate.