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 128
25 #define LTTNG_UST_COMM_VERSION_MAJOR 0
26 #define LTTNG_UST_COMM_VERSION_MINOR 1
28 enum lttng_ust_instrumentation
{
29 LTTNG_UST_TRACEPOINT
= 0,
31 LTTNG_UST_FUNCTION
= 2,
32 LTTNG_UST_TRACEPOINT_LOGLEVEL
= 3,
35 enum lttng_ust_output
{
39 struct lttng_ust_tracer_version
{
45 struct lttng_ust_channel
{
46 int overwrite
; /* 1: overwrite, 0: discard */
47 uint64_t subbuf_size
; /* in bytes */
49 unsigned int switch_timer_interval
; /* usecs */
50 unsigned int read_timer_interval
; /* usecs */
51 enum lttng_ust_output output
; /* output mode */
52 /* The following fields are used internally within UST. */
55 uint64_t memory_map_size
;
59 * This structure is only used internally within UST. It is not per-se
60 * part of the communication between sessiond and UST.
62 struct lttng_ust_stream
{
65 uint64_t memory_map_size
;
68 struct lttng_ust_event
{
69 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* event name */
70 enum lttng_ust_instrumentation instrumentation
;
71 /* Per instrumentation type configuration */
76 enum lttng_ust_context_type
{
77 LTTNG_UST_CONTEXT_VTID
= 0,
78 LTTNG_UST_CONTEXT_VPID
= 1,
79 LTTNG_UST_CONTEXT_PTHREAD_ID
= 2,
80 LTTNG_UST_CONTEXT_PROCNAME
= 3,
83 struct lttng_ust_context
{
84 enum lttng_ust_context_type ctx
;
90 * Tracer channel attributes.
92 struct lttng_ust_channel_attr
{
93 int overwrite
; /* 1: overwrite, 0: discard */
94 uint64_t subbuf_size
; /* bytes */
95 uint64_t num_subbuf
; /* power of 2 */
96 unsigned int switch_timer_interval
; /* usec */
97 unsigned int read_timer_interval
; /* usec */
98 enum lttng_ust_output output
; /* splice, mmap */
101 struct lttng_ust_object_data
{
105 uint64_t memory_map_size
;
108 #define _UST_CMD(minor) (minor)
109 #define _UST_CMDR(minor, type) (minor)
110 #define _UST_CMDW(minor, type) (minor)
112 /* Handled by object descriptor */
113 #define LTTNG_UST_RELEASE _UST_CMD(0x1)
115 /* Handled by object cmd */
117 /* LTTng-UST commands */
118 #define LTTNG_UST_SESSION _UST_CMD(0x40)
119 #define LTTNG_UST_TRACER_VERSION \
120 _UST_CMDR(0x41, struct lttng_ust_tracer_version)
121 #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42)
122 #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43)
123 #define LTTNG_UST_REGISTER_DONE _UST_CMD(0x44)
125 /* Session FD commands */
126 #define LTTNG_UST_METADATA \
127 _UST_CMDW(0x50, struct lttng_ust_channel)
128 #define LTTNG_UST_CHANNEL \
129 _UST_CMDW(0x51, struct lttng_ust_channel)
130 #define LTTNG_UST_SESSION_START _UST_CMD(0x52)
131 #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53)
133 /* Channel FD commands */
134 #define LTTNG_UST_STREAM _UST_CMD(0x60)
135 #define LTTNG_UST_EVENT \
136 _UST_CMDW(0x61, struct lttng_ust_event)
138 /* Event and Channel FD commands */
139 #define LTTNG_UST_CONTEXT \
140 _UST_CMDW(0x70, struct lttng_ust_context)
141 #define LTTNG_UST_FLUSH_BUFFER \
144 /* Event, Channel and Session commands */
145 #define LTTNG_UST_ENABLE _UST_CMD(0x80)
146 #define LTTNG_UST_DISABLE _UST_CMD(0x81)
148 /* Tracepoint list commands */
149 #define LTTNG_UST_TRACEPOINT_LIST_GET _UST_CMD(0x90)
151 #define LTTNG_UST_ROOT_HANDLE 0
153 struct lttng_ust_obj
;
155 struct lttng_ust_objd_ops
{
156 long (*cmd
)(int objd
, unsigned int cmd
, unsigned long arg
);
157 int (*release
)(int objd
);
160 /* Create root handle. Always ID 0. */
161 int lttng_abi_create_root_handle(void);
163 const struct lttng_ust_objd_ops
*objd_ops(int id
);
164 int lttng_ust_objd_unref(int id
);
166 void lttng_ust_abi_exit(void);
167 void lttng_ust_events_exit(void);
169 #endif /* _LTTNG_UST_ABI_H */