1 #ifndef _LTTNG_UST_ABI_H
2 #define _LTTNG_UST_ABI_H
9 * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
24 #define LTTNG_UST_SYM_NAME_LEN 256
26 #define LTTNG_UST_COMM_VERSION_MAJOR 2
27 #define LTTNG_UST_COMM_VERSION_MINOR 0
29 enum lttng_ust_instrumentation
{
30 LTTNG_UST_TRACEPOINT
= 0,
32 LTTNG_UST_FUNCTION
= 2,
35 enum lttng_ust_loglevel_type
{
36 LTTNG_UST_LOGLEVEL_ALL
= 0,
37 LTTNG_UST_LOGLEVEL_RANGE
= 1,
38 LTTNG_UST_LOGLEVEL_SINGLE
= 2,
41 enum lttng_ust_output
{
45 struct lttng_ust_tracer_version
{
51 #define LTTNG_UST_CHANNEL_PADDING LTTNG_UST_SYM_NAME_LEN + 32
52 struct lttng_ust_channel
{
53 int overwrite
; /* 1: overwrite, 0: discard */
54 uint64_t subbuf_size
; /* in bytes */
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
];
62 #define LTTNG_UST_STREAM_PADDING1 16
63 #define LTTNG_UST_STREAM_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
64 struct lttng_ust_stream
{
65 char padding
[LTTNG_UST_STREAM_PADDING1
];
68 char padding
[LTTNG_UST_STREAM_PADDING2
];
72 #define LTTNG_UST_EVENT_PADDING1 16
73 #define LTTNG_UST_EVENT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
74 struct lttng_ust_event
{
75 enum lttng_ust_instrumentation instrumentation
;
76 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* event name */
78 enum lttng_ust_loglevel_type loglevel_type
;
79 int loglevel
; /* value, -1: all */
80 char padding
[LTTNG_UST_EVENT_PADDING1
];
82 /* Per instrumentation type configuration */
84 char padding
[LTTNG_UST_EVENT_PADDING2
];
88 enum lttng_ust_context_type
{
89 LTTNG_UST_CONTEXT_VTID
= 0,
90 LTTNG_UST_CONTEXT_VPID
= 1,
91 LTTNG_UST_CONTEXT_PTHREAD_ID
= 2,
92 LTTNG_UST_CONTEXT_PROCNAME
= 3,
95 #define LTTNG_UST_CONTEXT_PADDING1 16
96 #define LTTNG_UST_CONTEXT_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
97 struct lttng_ust_context
{
98 enum lttng_ust_context_type ctx
;
99 char padding
[LTTNG_UST_CONTEXT_PADDING1
];
102 char padding
[LTTNG_UST_CONTEXT_PADDING2
];
107 * Tracer channel attributes.
109 #define LTTNG_UST_CHANNEL_ATTR_PADDING LTTNG_UST_SYM_NAME_LEN + 32
110 struct lttng_ust_channel_attr
{
111 int overwrite
; /* 1: overwrite, 0: discard */
112 uint64_t subbuf_size
; /* bytes */
113 uint64_t num_subbuf
; /* power of 2 */
114 unsigned int switch_timer_interval
; /* usec */
115 unsigned int read_timer_interval
; /* usec */
116 enum lttng_ust_output output
; /* splice, mmap */
117 char padding
[LTTNG_UST_CHANNEL_ATTR_PADDING
];
120 #define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
121 struct lttng_ust_tracepoint_iter
{
122 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* provider:name */
124 char padding
[LTTNG_UST_TRACEPOINT_ITER_PADDING
];
127 #define LTTNG_UST_OBJECT_DATA_PADDING LTTNG_UST_SYM_NAME_LEN + 32
128 struct lttng_ust_object_data
{
132 uint64_t memory_map_size
;
133 char padding
[LTTNG_UST_OBJECT_DATA_PADDING
];
136 enum lttng_ust_calibrate_type
{
137 LTTNG_UST_CALIBRATE_TRACEPOINT
,
140 #define LTTNG_UST_CALIBRATE_PADDING1 16
141 #define LTTNG_UST_CALIBRATE_PADDING2 LTTNG_UST_SYM_NAME_LEN + 32
142 struct lttng_ust_calibrate
{
143 enum lttng_ust_calibrate_type type
; /* type (input) */
144 char padding
[LTTNG_UST_CALIBRATE_PADDING1
];
147 char padding
[LTTNG_UST_CALIBRATE_PADDING2
];
151 #define _UST_CMD(minor) (minor)
152 #define _UST_CMDR(minor, type) (minor)
153 #define _UST_CMDW(minor, type) (minor)
155 /* Handled by object descriptor */
156 #define LTTNG_UST_RELEASE _UST_CMD(0x1)
158 /* Handled by object cmd */
160 /* LTTng-UST commands */
161 #define LTTNG_UST_SESSION _UST_CMD(0x40)
162 #define LTTNG_UST_TRACER_VERSION \
163 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
164 #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
165 #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
166 #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
168 /* Session FD commands */
169 #define LTTNG_UST_METADATA \
170 _UST_CMDW(0x50, struct lttng_ust_channel)
171 #define LTTNG_UST_CHANNEL \
172 _UST_CMDW(0x51, struct lttng_ust_channel)
173 #define LTTNG_UST_SESSION_START _UST_CMD(0x52)
174 #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
176 /* Channel FD commands */
177 #define LTTNG_UST_STREAM _UST_CMD(0x60)
178 #define LTTNG_UST_EVENT \
179 _UST_CMDW(0x61, struct lttng_ust_event)
181 /* Event and Channel FD commands */
182 #define LTTNG_UST_CONTEXT \
183 _UST_CMDW(0x70, struct lttng_ust_context)
184 #define LTTNG_UST_FLUSH_BUFFER \
187 /* Event, Channel and Session commands */
188 #define LTTNG_UST_ENABLE _UST_CMD(0x80)
189 #define LTTNG_UST_DISABLE _UST_CMD(0x81)
191 /* Tracepoint list commands */
192 #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
194 #define LTTNG_UST_ROOT_HANDLE 0
196 struct lttng_ust_obj
;
202 uint64_t *memory_map_size
;
207 uint64_t *memory_map_size
;
211 struct lttng_ust_objd_ops
{
212 long (*cmd
)(int objd
, unsigned int cmd
, unsigned long arg
,
213 union ust_args
*args
);
214 int (*release
)(int objd
);
217 /* Create root handle. Always ID 0. */
218 int lttng_abi_create_root_handle(void);
220 const struct lttng_ust_objd_ops
*objd_ops(int id
);
221 int lttng_ust_objd_unref(int id
);
223 void lttng_ust_abi_exit(void);
224 void lttng_ust_events_exit(void);
226 #endif /* _LTTNG_UST_ABI_H */