4 * Linux Trace Toolkit Control Library Header File
6 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include <asm/types.h>
30 /* Default unix group name for tracing. */
31 #define LTTNG_DEFAULT_TRACING_GROUP "tracing"
33 /* Environment variable to set session daemon binary path. */
34 #define LTTNG_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH"
36 /* Default trace output directory name */
37 #define LTTNG_DEFAULT_TRACE_DIR_NAME "lttng-traces"
40 * Event symbol length. Copied from LTTng kernel ABI.
42 #define LTTNG_SYMBOL_NAME_LEN 128
45 * Every lttng_event_* structure both apply to kernel event and user-space
48 * Every lttng_kernel_* is copied from the LTTng kernel ABI.
51 enum lttng_event_type
{
52 LTTNG_EVENT_TRACEPOINT
,
60 enum lttng_event_output
{
62 LTTNG_EVENT_SPLICE
= 0,
67 /* Kernel context possible type */
68 enum lttng_kernel_context_type
{
69 LTTNG_KERNEL_CONTEXT_PID
= 0,
70 LTTNG_KERNEL_CONTEXT_PERF_COUNTER
= 1,
71 LTTNG_KERNEL_CONTEXT_COMM
= 2,
72 LTTNG_KERNEL_CONTEXT_PRIO
= 3,
73 LTTNG_KERNEL_CONTEXT_NICE
= 4,
74 LTTNG_KERNEL_CONTEXT_VPID
= 5,
75 LTTNG_KERNEL_CONTEXT_TID
= 6,
76 LTTNG_KERNEL_CONTEXT_VTID
= 7,
77 LTTNG_KERNEL_CONTEXT_PPID
= 8,
78 LTTNG_KERNEL_CONTEXT_VPPID
= 9,
81 /* Perf counter attributes */
82 struct lttng_kernel_perf_counter_ctx
{
85 char name
[LTTNG_SYMBOL_NAME_LEN
];
88 /* Event/Channel context */
89 struct lttng_kernel_context
{
90 enum lttng_kernel_context_type ctx
;
92 struct lttng_kernel_perf_counter_ctx perf_counter
;
97 * Kernel Kprobe. Either addr is used or symbol_name and offset.
99 struct lttng_kernel_kprobe_attr
{
103 char symbol_name
[LTTNG_SYMBOL_NAME_LEN
];
109 struct lttng_event_function_attr
{
110 char symbol_name
[LTTNG_SYMBOL_NAME_LEN
];
114 * Generic lttng event
117 char name
[LTTNG_SYMBOL_NAME_LEN
];
118 enum lttng_event_type type
;
119 /* Per event type configuration */
121 struct lttng_kernel_kprobe_attr kprobe
;
122 struct lttng_event_function_attr ftrace
;
127 * Tracer channel attributes. For both kernel and user-space.
129 struct lttng_channel_attr
{
130 int overwrite
; /* 1: overwrite, 0: discard */
131 uint64_t subbuf_size
; /* bytes */
132 uint64_t num_subbuf
; /* power of 2 */
133 unsigned int switch_timer_interval
; /* usec */
134 unsigned int read_timer_interval
; /* usec */
135 enum lttng_event_output output
; /* splice, mmap */
139 * Channel information structure. For both kernel and user-space.
141 struct lttng_channel
{
143 struct lttng_channel_attr attr
;
147 * Basic session information.
149 * This is an 'output data' meaning that it only comes *from* the session
150 * daemon *to* the lttng client. It's basically a 'human' representation of
151 * tracing entities (here a session).
153 struct lttng_session
{
155 /* The path where traces are written */
160 * Session daemon control
162 extern int lttng_create_session(char *name
, char *path
);
164 extern int lttng_destroy_session(char *name
);
167 * Return a "lttng_session" array. Caller must free(3) the returned data.
169 extern int lttng_list_sessions(struct lttng_session
**sessions
);
171 extern int lttng_session_daemon_alive(void);
173 /* Set tracing group for the current execution */
174 extern int lttng_set_tracing_group(const char *name
);
176 extern void lttng_set_session_name(char *name
);
178 extern const char *lttng_get_readable_code(int code
);
180 extern int lttng_start_tracing(char *session_name
);
182 extern int lttng_stop_tracing(char *session_name
);
185 * LTTng Kernel tracer control
187 extern int lttng_kernel_add_context(struct lttng_kernel_context
*ctx
,
188 char *event_name
, char *channel_name
);
190 extern int lttng_kernel_create_channel(struct lttng_channel
*chan
);
192 extern int lttng_kernel_enable_event(struct lttng_event
*ev
, char *channel_name
);
194 extern int lttng_kernel_enable_channel(char *name
);
196 extern int lttng_kernel_disable_event(char *name
, char *channel_name
);
198 extern int lttng_kernel_disable_channel(char *name
);
200 extern int lttng_kernel_list_events(char **event_list
);
203 * LTTng User-space tracer control
206 //extern int lttng_ust_list_traceable_apps(pid_t **pids);
208 #endif /* _LTTNG_H */