1 #ifndef _LTTNG_UST_ABI_H
2 #define _LTTNG_UST_ABI_H
7 * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
12 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
14 * Permission is hereby granted to use or copy this program
15 * for any purpose, provided the above notices are retained on all copies.
16 * Permission to modify the code and to distribute modified code is granted,
17 * provided the above notices are retained, and a notice that the code was
18 * modified is included with the above copyright notice.
23 #define LTTNG_UST_SYM_NAME_LEN 256
25 #define LTTNG_UST_COMM_VERSION_MAJOR 2
26 #define LTTNG_UST_COMM_VERSION_MINOR 0
28 enum lttng_ust_instrumentation
{
29 LTTNG_UST_TRACEPOINT
= 0,
31 LTTNG_UST_FUNCTION
= 2,
34 enum lttng_ust_loglevel_type
{
35 LTTNG_UST_LOGLEVEL_ALL
= 0,
36 LTTNG_UST_LOGLEVEL_RANGE
= 1,
37 LTTNG_UST_LOGLEVEL_SINGLE
= 2,
40 enum lttng_ust_output
{
44 struct lttng_ust_tracer_version
{
50 #define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
51 struct lttng_ust_channel
{
52 int overwrite
; /* 1: overwrite, 0: discard */
53 uint64_t subbuf_size
; /* in bytes */
55 unsigned int switch_timer_interval
; /* usecs */
56 unsigned int read_timer_interval
; /* usecs */
57 enum lttng_ust_output output
; /* output mode */
58 char padding
[LTTNG_UST_CHANNEL_PADDING
];
61 #define LTTNG_UST_STREAM_PADDING1 16
62 #define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
63 struct lttng_ust_stream
{
64 char padding
[LTTNG_UST_STREAM_PADDING1
];
67 char padding
[LTTNG_UST_STREAM_PADDING2
];
71 #define LTTNG_UST_EVENT_PADDING1 16
72 #define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
73 struct lttng_ust_event
{
74 enum lttng_ust_instrumentation instrumentation
;
75 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* event name */
77 enum lttng_ust_loglevel_type loglevel_type
;
78 int loglevel
; /* value, -1: all */
79 char padding
[LTTNG_UST_EVENT_PADDING1
];
81 /* Per instrumentation type configuration */
83 char padding
[LTTNG_UST_EVENT_PADDING2
];
87 enum lttng_ust_context_type
{
88 LTTNG_UST_CONTEXT_VTID
= 0,
89 LTTNG_UST_CONTEXT_VPID
= 1,
90 LTTNG_UST_CONTEXT_PTHREAD_ID
= 2,
91 LTTNG_UST_CONTEXT_PROCNAME
= 3,
94 #define LTTNG_UST_CONTEXT_PADDING1 16
95 #define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
96 struct lttng_ust_context
{
97 enum lttng_ust_context_type ctx
;
98 char padding
[LTTNG_UST_CONTEXT_PADDING1
];
101 char padding
[LTTNG_UST_CONTEXT_PADDING2
];
106 * Tracer channel attributes.
108 #define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
109 struct lttng_ust_channel_attr
{
110 int overwrite
; /* 1: overwrite, 0: discard */
111 uint64_t subbuf_size
; /* bytes */
112 uint64_t num_subbuf
; /* power of 2 */
113 unsigned int switch_timer_interval
; /* usec */
114 unsigned int read_timer_interval
; /* usec */
115 enum lttng_ust_output output
; /* splice, mmap */
116 char padding
[LTTNG_UST_CHANNEL_ATTR_PADDING
];
119 #define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
120 struct lttng_ust_tracepoint_iter
{
121 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* provider:name */
123 char padding
[LTTNG_UST_TRACEPOINT_ITER_PADDING
];
126 #define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
127 struct lttng_ust_object_data
{
131 uint64_t memory_map_size
;
132 char padding
[LTTNG_UST_OBJECT_DATA_PADDING
];
135 enum lttng_ust_calibrate_type
{
136 LTTNG_UST_CALIBRATE_TRACEPOINT
,
139 #define LTTNG_UST_CALIBRATE_PADDING1 16
140 #define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
141 struct lttng_ust_calibrate
{
142 enum lttng_ust_calibrate_type type
; /* type (input) */
143 char padding
[LTTNG_UST_CALIBRATE_PADDING1
];
146 char padding
[LTTNG_UST_CALIBRATE_PADDING2
];
150 #define _UST_CMD(minor) (minor)
151 #define _UST_CMDR(minor, type) (minor)
152 #define _UST_CMDW(minor, type) (minor)
154 /* Handled by object descriptor */
155 #define LTTNG_UST_RELEASE _UST_CMD(0x1)
157 /* Handled by object cmd */
159 /* LTTng-UST commands */
160 #define LTTNG_UST_SESSION _UST_CMD(0x40)
161 #define LTTNG_UST_TRACER_VERSION \
162 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
163 #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
164 #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
165 #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
167 /* Session FD commands */
168 #define LTTNG_UST_METADATA \
169 _UST_CMDW(0x50, struct lttng_ust_channel)
170 #define LTTNG_UST_CHANNEL \
171 _UST_CMDW(0x51, struct lttng_ust_channel)
172 #define LTTNG_UST_SESSION_START _UST_CMD(0x52)
173 #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
175 /* Channel FD commands */
176 #define LTTNG_UST_STREAM _UST_CMD(0x60)
177 #define LTTNG_UST_EVENT \
178 _UST_CMDW(0x61, struct lttng_ust_event)
180 /* Event and Channel FD commands */
181 #define LTTNG_UST_CONTEXT \
182 _UST_CMDW(0x70, struct lttng_ust_context)
183 #define LTTNG_UST_FLUSH_BUFFER \
186 /* Event, Channel and Session commands */
187 #define LTTNG_UST_ENABLE _UST_CMD(0x80)
188 #define LTTNG_UST_DISABLE _UST_CMD(0x81)
190 /* Tracepoint list commands */
191 #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
193 #define LTTNG_UST_ROOT_HANDLE 0
195 struct lttng_ust_obj
;
201 uint64_t *memory_map_size
;
206 uint64_t *memory_map_size
;
210 struct lttng_ust_objd_ops
{
211 long (*cmd
)(int objd
, unsigned int cmd
, unsigned long arg
,
212 union ust_args
*args
);
213 int (*release
)(int objd
);
216 /* Create root handle. Always ID 0. */
217 int lttng_abi_create_root_handle(void);
219 const struct lttng_ust_objd_ops
*objd_ops(int id
);
220 int lttng_ust_objd_unref(int id
);
222 void lttng_ust_abi_exit(void);
223 void lttng_ust_events_exit(void);
225 #endif /* _LTTNG_UST_ABI_H */