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, free of charge, to any person obtaining a copy
15 * of this software and associated documentation files (the "Software"), to deal
16 * in the Software without restriction, including without limitation the rights
17 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 * copies of the Software, and to permit persons to whom the Software is
19 * furnished to do so, subject to the following conditions:
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
27 #define LTTNG_UST_SYM_NAME_LEN 256
29 #define LTTNG_UST_COMM_VERSION_MAJOR 2
30 #define LTTNG_UST_COMM_VERSION_MINOR 0
32 enum lttng_ust_instrumentation
{
33 LTTNG_UST_TRACEPOINT
= 0,
35 LTTNG_UST_FUNCTION
= 2,
38 enum lttng_ust_loglevel_type
{
39 LTTNG_UST_LOGLEVEL_ALL
= 0,
40 LTTNG_UST_LOGLEVEL_RANGE
= 1,
41 LTTNG_UST_LOGLEVEL_SINGLE
= 2,
44 enum lttng_ust_output
{
48 struct lttng_ust_tracer_version
{
54 #define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
55 struct lttng_ust_channel
{
56 int overwrite
; /* 1: overwrite, 0: discard */
57 uint64_t subbuf_size
; /* in bytes */
59 unsigned int switch_timer_interval
; /* usecs */
60 unsigned int read_timer_interval
; /* usecs */
61 enum lttng_ust_output output
; /* output mode */
62 char padding
[LTTNG_UST_CHANNEL_PADDING
];
65 #define LTTNG_UST_STREAM_PADDING1 16
66 #define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
67 struct lttng_ust_stream
{
68 char padding
[LTTNG_UST_STREAM_PADDING1
];
71 char padding
[LTTNG_UST_STREAM_PADDING2
];
75 #define LTTNG_UST_EVENT_PADDING1 16
76 #define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
77 struct lttng_ust_event
{
78 enum lttng_ust_instrumentation instrumentation
;
79 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* event name */
81 enum lttng_ust_loglevel_type loglevel_type
;
82 int loglevel
; /* value, -1: all */
83 char padding
[LTTNG_UST_EVENT_PADDING1
];
85 /* Per instrumentation type configuration */
87 char padding
[LTTNG_UST_EVENT_PADDING2
];
91 enum lttng_ust_field_type
{
92 LTTNG_UST_FIELD_OTHER
= 0,
93 LTTNG_UST_FIELD_INTEGER
= 1,
94 LTTNG_UST_FIELD_ENUM
= 2,
95 LTTNG_UST_FIELD_FLOAT
= 3,
96 LTTNG_UST_FIELD_STRING
= 4,
99 #define LTTNG_UST_FIELD_ITER_PADDING LTTNG_UST_SYM_NAME_LEN + 32
100 struct lttng_ust_field_iter
{
101 char event_name
[LTTNG_UST_SYM_NAME_LEN
];
102 char field_name
[LTTNG_UST_SYM_NAME_LEN
];
103 enum lttng_ust_field_type type
;
104 int loglevel
; /* event loglevel */
105 char padding
[LTTNG_UST_FIELD_ITER_PADDING
];
108 enum lttng_ust_context_type
{
109 LTTNG_UST_CONTEXT_VTID
= 0,
110 LTTNG_UST_CONTEXT_VPID
= 1,
111 LTTNG_UST_CONTEXT_PTHREAD_ID
= 2,
112 LTTNG_UST_CONTEXT_PROCNAME
= 3,
115 #define LTTNG_UST_CONTEXT_PADDING1 16
116 #define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
117 struct lttng_ust_context
{
118 enum lttng_ust_context_type ctx
;
119 char padding
[LTTNG_UST_CONTEXT_PADDING1
];
122 char padding
[LTTNG_UST_CONTEXT_PADDING2
];
127 * Tracer channel attributes.
129 #define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
130 struct lttng_ust_channel_attr
{
131 int overwrite
; /* 1: overwrite, 0: discard */
132 uint64_t subbuf_size
; /* bytes */
133 uint64_t num_subbuf
; /* power of 2 */
134 unsigned int switch_timer_interval
; /* usec */
135 unsigned int read_timer_interval
; /* usec */
136 enum lttng_ust_output output
; /* splice, mmap */
137 char padding
[LTTNG_UST_CHANNEL_ATTR_PADDING
];
140 #define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
141 struct lttng_ust_tracepoint_iter
{
142 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* provider:name */
144 char padding
[LTTNG_UST_TRACEPOINT_ITER_PADDING
];
147 #define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
148 struct lttng_ust_object_data
{
152 uint64_t memory_map_size
;
153 char padding
[LTTNG_UST_OBJECT_DATA_PADDING
];
156 enum lttng_ust_calibrate_type
{
157 LTTNG_UST_CALIBRATE_TRACEPOINT
,
160 #define LTTNG_UST_CALIBRATE_PADDING1 16
161 #define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
162 struct lttng_ust_calibrate
{
163 enum lttng_ust_calibrate_type type
; /* type (input) */
164 char padding
[LTTNG_UST_CALIBRATE_PADDING1
];
167 char padding
[LTTNG_UST_CALIBRATE_PADDING2
];
171 #define FILTER_BYTECODE_MAX_LEN 65535
172 struct lttng_ust_filter_bytecode
{
174 uint16_t reloc_offset
;
178 #define _UST_CMD(minor) (minor)
179 #define _UST_CMDR(minor, type) (minor)
180 #define _UST_CMDW(minor, type) (minor)
182 /* Handled by object descriptor */
183 #define LTTNG_UST_RELEASE _UST_CMD(0x1)
185 /* Handled by object cmd */
187 /* LTTng-UST commands */
188 #define LTTNG_UST_SESSION _UST_CMD(0x40)
189 #define LTTNG_UST_TRACER_VERSION \
190 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
191 #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
192 #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
193 #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
194 #define LTTNG_UST_TRACEPOINT_FIELD_LIST _UST_CMD(0x45)
196 /* Session FD commands */
197 #define LTTNG_UST_METADATA \
198 _UST_CMDW(0x50, struct lttng_ust_channel)
199 #define LTTNG_UST_CHANNEL \
200 _UST_CMDW(0x51, struct lttng_ust_channel)
201 #define LTTNG_UST_SESSION_START _UST_CMD(0x52)
202 #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
204 /* Channel FD commands */
205 #define LTTNG_UST_STREAM _UST_CMD(0x60)
206 #define LTTNG_UST_EVENT \
207 _UST_CMDW(0x61, struct lttng_ust_event)
209 /* Event and Channel FD commands */
210 #define LTTNG_UST_CONTEXT \
211 _UST_CMDW(0x70, struct lttng_ust_context)
212 #define LTTNG_UST_FLUSH_BUFFER \
215 /* Event, Channel and Session commands */
216 #define LTTNG_UST_ENABLE _UST_CMD(0x80)
217 #define LTTNG_UST_DISABLE _UST_CMD(0x81)
219 /* Tracepoint list commands */
220 #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
221 #define LTTNG_UST_TRACEPOINT_FIELD_LIST_GET _UST_CMD(0x91)
223 #define LTTNG_UST_ROOT_HANDLE 0
225 struct lttng_ust_obj
;
231 uint64_t *memory_map_size
;
236 uint64_t *memory_map_size
;
239 struct lttng_ust_field_iter entry
;
243 struct lttng_ust_objd_ops
{
244 long (*cmd
)(int objd
, unsigned int cmd
, unsigned long arg
,
245 union ust_args
*args
);
246 int (*release
)(int objd
);
249 /* Create root handle. Always ID 0. */
250 int lttng_abi_create_root_handle(void);
252 const struct lttng_ust_objd_ops
*objd_ops(int id
);
253 int lttng_ust_objd_unref(int id
);
255 void lttng_ust_abi_exit(void);
256 void lttng_ust_events_exit(void);
258 #endif /* _LTTNG_UST_ABI_H */