1 #ifndef _LTTNG_UST_ABI_H
2 #define _LTTNG_UST_ABI_H
7 * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * Dual LGPL v2.1/GPL v2 license.
16 #define LTTNG_UST_SYM_NAME_LEN 256
18 #define LTTNG_UST_COMM_VERSION_MAJOR 0
19 #define LTTNG_UST_COMM_VERSION_MINOR 1
21 enum lttng_ust_instrumentation
{
22 LTTNG_UST_TRACEPOINT
= 0,
24 LTTNG_UST_FUNCTION
= 2,
25 LTTNG_UST_TRACEPOINT_LOGLEVEL
= 3,
28 enum lttng_ust_output
{
32 struct lttng_ust_tracer_version
{
38 struct lttng_ust_channel
{
39 int overwrite
; /* 1: overwrite, 0: discard */
40 uint64_t subbuf_size
; /* in bytes */
42 unsigned int switch_timer_interval
; /* usecs */
43 unsigned int read_timer_interval
; /* usecs */
44 enum lttng_ust_output output
; /* output mode */
47 struct lttng_ust_event
{
48 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* event name */
49 enum lttng_ust_instrumentation instrumentation
;
50 /* Per instrumentation type configuration */
55 enum lttng_ust_context_type
{
56 LTTNG_UST_CONTEXT_VTID
= 0,
57 LTTNG_UST_CONTEXT_VPID
= 1,
58 LTTNG_UST_CONTEXT_PTHREAD_ID
= 2,
59 LTTNG_UST_CONTEXT_PROCNAME
= 3,
62 struct lttng_ust_context
{
63 enum lttng_ust_context_type ctx
;
69 * Tracer channel attributes.
71 struct lttng_ust_channel_attr
{
72 int overwrite
; /* 1: overwrite, 0: discard */
73 uint64_t subbuf_size
; /* bytes */
74 uint64_t num_subbuf
; /* power of 2 */
75 unsigned int switch_timer_interval
; /* usec */
76 unsigned int read_timer_interval
; /* usec */
77 enum lttng_ust_output output
; /* splice, mmap */
80 struct lttng_ust_tracepoint_iter
{
81 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* provider:name */
82 char loglevel
[LTTNG_UST_SYM_NAME_LEN
]; /* loglevel */
83 int64_t loglevel_value
;
86 struct lttng_ust_object_data
{
90 uint64_t memory_map_size
;
93 enum lttng_ust_calibrate_type
{
94 LTTNG_UST_CALIBRATE_TRACEPOINT
,
97 struct lttng_ust_calibrate
{
98 enum lttng_ust_calibrate_type type
; /* type (input) */
101 #define _UST_CMD(minor) (minor)
102 #define _UST_CMDR(minor, type) (minor)
103 #define _UST_CMDW(minor, type) (minor)
105 /* Handled by object descriptor */
106 #define LTTNG_UST_RELEASE _UST_CMD(0x1)
108 /* Handled by object cmd */
110 /* LTTng-UST commands */
111 #define LTTNG_UST_SESSION _UST_CMD(0x40)
112 #define LTTNG_UST_TRACER_VERSION \
113 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
114 #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
115 #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
116 #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
118 /* Session FD commands */
119 #define LTTNG_UST_METADATA \
120 _UST_CMDW(0x50, struct lttng_ust_channel)
121 #define LTTNG_UST_CHANNEL \
122 _UST_CMDW(0x51, struct lttng_ust_channel)
123 #define LTTNG_UST_SESSION_START _UST_CMD(0x52)
124 #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
126 /* Channel FD commands */
127 #define LTTNG_UST_STREAM _UST_CMD(0x60)
128 #define LTTNG_UST_EVENT \
129 _UST_CMDW(0x61, struct lttng_ust_event)
131 /* Event and Channel FD commands */
132 #define LTTNG_UST_CONTEXT \
133 _UST_CMDW(0x70, struct lttng_ust_context)
134 #define LTTNG_UST_FLUSH_BUFFER \
137 /* Event, Channel and Session commands */
138 #define LTTNG_UST_ENABLE _UST_CMD(0x80)
139 #define LTTNG_UST_DISABLE _UST_CMD(0x81)
141 /* Tracepoint list commands */
142 #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
144 #define LTTNG_UST_ROOT_HANDLE 0
146 struct lttng_ust_obj
;
152 uint64_t *memory_map_size
;
157 uint64_t *memory_map_size
;
161 struct lttng_ust_objd_ops
{
162 long (*cmd
)(int objd
, unsigned int cmd
, unsigned long arg
,
163 union ust_args
*args
);
164 int (*release
)(int objd
);
167 /* Create root handle. Always ID 0. */
168 int lttng_abi_create_root_handle(void);
170 const struct lttng_ust_objd_ops
*objd_ops(int id
);
171 int lttng_ust_objd_unref(int id
);
173 void lttng_ust_abi_exit(void);
174 void lttng_ust_events_exit(void);
176 #endif /* _LTTNG_UST_ABI_H */