Filter: prepare filter stack data
[lttng-ust.git] / include / lttng / ust-abi.h
... / ...
CommitLineData
1#ifndef _LTTNG_UST_ABI_H
2#define _LTTNG_UST_ABI_H
3
4/*
5 * lttng/ust-abi.h
6 *
7 * LTTng-UST ABI header
8 *
9 * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 */
21
22#include <stdint.h>
23
24#define LTTNG_UST_SYM_NAME_LEN 256
25
26#define LTTNG_UST_COMM_VERSION_MAJOR 2
27#define LTTNG_UST_COMM_VERSION_MINOR 0
28
29enum lttng_ust_instrumentation {
30 LTTNG_UST_TRACEPOINT = 0,
31 LTTNG_UST_PROBE = 1,
32 LTTNG_UST_FUNCTION = 2,
33};
34
35enum lttng_ust_loglevel_type {
36 LTTNG_UST_LOGLEVEL_ALL = 0,
37 LTTNG_UST_LOGLEVEL_RANGE = 1,
38 LTTNG_UST_LOGLEVEL_SINGLE = 2,
39};
40
41enum lttng_ust_output {
42 LTTNG_UST_MMAP = 0,
43};
44
45struct lttng_ust_tracer_version {
46 uint32_t major;
47 uint32_t minor;
48 uint32_t patchlevel;
49};
50
51#define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
52struct lttng_ust_channel {
53 int overwrite; /* 1: overwrite, 0: discard */
54 uint64_t subbuf_size; /* in bytes */
55 uint64_t num_subbuf;
56 unsigned int switch_timer_interval; /* usecs */
57 unsigned int read_timer_interval; /* usecs */
58 enum lttng_ust_output output; /* output mode */
59 char padding[LTTNG_UST_CHANNEL_PADDING];
60};
61
62#define LTTNG_UST_STREAM_PADDING1 16
63#define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
64struct lttng_ust_stream {
65 char padding[LTTNG_UST_STREAM_PADDING1];
66
67 union {
68 char padding[LTTNG_UST_STREAM_PADDING2];
69 } u;
70};
71
72#define LTTNG_UST_EVENT_PADDING1 16
73#define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
74struct lttng_ust_event {
75 enum lttng_ust_instrumentation instrumentation;
76 char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */
77
78 enum lttng_ust_loglevel_type loglevel_type;
79 int loglevel; /* value, -1: all */
80 char padding[LTTNG_UST_EVENT_PADDING1];
81
82 /* Per instrumentation type configuration */
83 union {
84 char padding[LTTNG_UST_EVENT_PADDING2];
85 } u;
86};
87
88enum lttng_ust_field_type {
89 LTTNG_UST_FIELD_OTHER = 0,
90 LTTNG_UST_FIELD_INTEGER = 1,
91 LTTNG_UST_FIELD_ENUM = 2,
92 LTTNG_UST_FIELD_FLOAT = 3,
93 LTTNG_UST_FIELD_STRING = 4,
94};
95
96#define LTTNG_UST_FIELD_ITER_PADDING LTTNG_UST_SYM_NAME_LEN + 32
97struct lttng_ust_field_iter {
98 char event_name[LTTNG_UST_SYM_NAME_LEN];
99 char field_name[LTTNG_UST_SYM_NAME_LEN];
100 enum lttng_ust_field_type type;
101 int loglevel; /* event loglevel */
102 char padding[LTTNG_UST_FIELD_ITER_PADDING];
103};
104
105enum lttng_ust_context_type {
106 LTTNG_UST_CONTEXT_VTID = 0,
107 LTTNG_UST_CONTEXT_VPID = 1,
108 LTTNG_UST_CONTEXT_PTHREAD_ID = 2,
109 LTTNG_UST_CONTEXT_PROCNAME = 3,
110};
111
112#define LTTNG_UST_CONTEXT_PADDING1 16
113#define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
114struct lttng_ust_context {
115 enum lttng_ust_context_type ctx;
116 char padding[LTTNG_UST_CONTEXT_PADDING1];
117
118 union {
119 char padding[LTTNG_UST_CONTEXT_PADDING2];
120 } u;
121};
122
123/*
124 * Tracer channel attributes.
125 */
126#define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
127struct lttng_ust_channel_attr {
128 int overwrite; /* 1: overwrite, 0: discard */
129 uint64_t subbuf_size; /* bytes */
130 uint64_t num_subbuf; /* power of 2 */
131 unsigned int switch_timer_interval; /* usec */
132 unsigned int read_timer_interval; /* usec */
133 enum lttng_ust_output output; /* splice, mmap */
134 char padding[LTTNG_UST_CHANNEL_ATTR_PADDING];
135};
136
137#define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
138struct lttng_ust_tracepoint_iter {
139 char name[LTTNG_UST_SYM_NAME_LEN]; /* provider:name */
140 int loglevel;
141 char padding[LTTNG_UST_TRACEPOINT_ITER_PADDING];
142};
143
144#define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
145struct lttng_ust_object_data {
146 int handle;
147 int shm_fd;
148 int wait_fd;
149 uint64_t memory_map_size;
150 char padding[LTTNG_UST_OBJECT_DATA_PADDING];
151};
152
153enum lttng_ust_calibrate_type {
154 LTTNG_UST_CALIBRATE_TRACEPOINT,
155};
156
157#define LTTNG_UST_CALIBRATE_PADDING1 16
158#define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
159struct lttng_ust_calibrate {
160 enum lttng_ust_calibrate_type type; /* type (input) */
161 char padding[LTTNG_UST_CALIBRATE_PADDING1];
162
163 union {
164 char padding[LTTNG_UST_CALIBRATE_PADDING2];
165 } u;
166};
167
168#define _UST_CMD(minor) (minor)
169#define _UST_CMDR(minor, type) (minor)
170#define _UST_CMDW(minor, type) (minor)
171
172/* Handled by object descriptor */
173#define LTTNG_UST_RELEASE _UST_CMD(0x1)
174
175/* Handled by object cmd */
176
177/* LTTng-UST commands */
178#define LTTNG_UST_SESSION _UST_CMD(0x40)
179#define LTTNG_UST_TRACER_VERSION \
180 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
181#define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
182#define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
183#define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
184#define LTTNG_UST_TRACEPOINT_FIELD_LIST _UST_CMD(0x45)
185
186/* Session FD commands */
187#define LTTNG_UST_METADATA \
188 _UST_CMDW(0x50, struct lttng_ust_channel)
189#define LTTNG_UST_CHANNEL \
190 _UST_CMDW(0x51, struct lttng_ust_channel)
191#define LTTNG_UST_SESSION_START _UST_CMD(0x52)
192#define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
193
194/* Channel FD commands */
195#define LTTNG_UST_STREAM _UST_CMD(0x60)
196#define LTTNG_UST_EVENT \
197 _UST_CMDW(0x61, struct lttng_ust_event)
198
199/* Event and Channel FD commands */
200#define LTTNG_UST_CONTEXT \
201 _UST_CMDW(0x70, struct lttng_ust_context)
202#define LTTNG_UST_FLUSH_BUFFER \
203 _UST_CMD(0x71)
204
205/* Event, Channel and Session commands */
206#define LTTNG_UST_ENABLE _UST_CMD(0x80)
207#define LTTNG_UST_DISABLE _UST_CMD(0x81)
208
209/* Tracepoint list commands */
210#define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
211#define LTTNG_UST_TRACEPOINT_FIELD_LIST_GET _UST_CMD(0x91)
212
213#define LTTNG_UST_ROOT_HANDLE 0
214
215struct lttng_ust_obj;
216
217union ust_args {
218 struct {
219 int *shm_fd;
220 int *wait_fd;
221 uint64_t *memory_map_size;
222 } channel;
223 struct {
224 int *shm_fd;
225 int *wait_fd;
226 uint64_t *memory_map_size;
227 } stream;
228 struct {
229 struct lttng_ust_field_iter entry;
230 } field_list;
231};
232
233struct lttng_ust_objd_ops {
234 long (*cmd)(int objd, unsigned int cmd, unsigned long arg,
235 union ust_args *args);
236 int (*release)(int objd);
237};
238
239/* Create root handle. Always ID 0. */
240int lttng_abi_create_root_handle(void);
241
242const struct lttng_ust_objd_ops *objd_ops(int id);
243int lttng_ust_objd_unref(int id);
244
245void lttng_ust_abi_exit(void);
246void lttng_ust_events_exit(void);
247
248#endif /* _LTTNG_UST_ABI_H */
This page took 0.02333 seconds and 4 git commands to generate.