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.
42 #define LTTNG_SYMBOL_NAME_LEN 128
44 enum lttng_event_type
{
45 LTTNG_EVENT_TRACEPOINTS
,
50 /* Kernel context possible type */
51 enum lttng_kernel_context_type
{
52 LTTNG_KERNEL_CONTEXT_PID
= 0,
53 LTTNG_KERNEL_CONTEXT_PERF_COUNTER
= 1,
54 LTTNG_KERNEL_CONTEXT_COMM
= 2,
55 LTTNG_KERNEL_CONTEXT_PRIO
= 3,
56 LTTNG_KERNEL_CONTEXT_NICE
= 4,
57 LTTNG_KERNEL_CONTEXT_VPID
= 5,
58 LTTNG_KERNEL_CONTEXT_TID
= 6,
59 LTTNG_KERNEL_CONTEXT_VTID
= 7,
60 LTTNG_KERNEL_CONTEXT_PPID
= 8,
61 LTTNG_KERNEL_CONTEXT_VPPID
= 9,
64 /* Perf counter attributes */
65 struct lttng_kernel_perf_counter_ctx
{
68 char name
[LTTNG_SYMBOL_NAME_LEN
];
71 /* Event/Channel context */
72 struct lttng_kernel_context
{
73 enum lttng_kernel_context_type ctx
;
75 struct lttng_kernel_perf_counter_ctx perf_counter
;
82 enum lttng_kernel_output
{
83 LTTNG_KERNEL_SPLICE
= 0,
84 LTTNG_KERNEL_MMAP
= 1,
88 * Either addr is used or symbol_name and offset.
90 struct lttng_event_kprobe_attr
{
94 char symbol_name
[LTTNG_SYMBOL_NAME_LEN
];
100 struct lttng_event_function_attr
{
101 char symbol_name
[LTTNG_SYMBOL_NAME_LEN
];
105 * Generic lttng event
108 char name
[LTTNG_SYMBOL_NAME_LEN
];
109 enum lttng_event_type type
;
110 /* Per event type configuration */
112 struct lttng_event_kprobe_attr kprobe
;
113 struct lttng_event_function_attr ftrace
;
117 /* Tracer channel attributes */
118 struct lttng_channel_attr
{
119 int overwrite
; /* 1: overwrite, 0: discard */
120 uint64_t subbuf_size
; /* bytes */
121 uint64_t num_subbuf
; /* power of 2 */
122 unsigned int switch_timer_interval
; /* usec */
123 unsigned int read_timer_interval
; /* usec */
124 enum lttng_kernel_output output
; /* splice, mmap */
128 * Basic session information.
130 struct lttng_session
{
135 /* Channel information structure */
136 struct lttng_channel
{
138 struct lttng_channel_attr attr
;
142 * Session daemon control
144 extern int lttng_connect_sessiond(void);
146 extern int lttng_create_session(char *name
, char *path
);
148 extern int lttng_destroy_session(char *name
);
150 extern int lttng_disconnect_sessiond(void);
152 /* Return an allocated array of lttng_session */
153 extern int lttng_list_sessions(struct lttng_session
**sessions
);
155 extern int lttng_session_daemon_alive(void);
157 /* Set tracing group for the current execution */
158 extern int lttng_set_tracing_group(const char *name
);
160 extern void lttng_set_session_name(char *name
);
162 extern const char *lttng_get_readable_code(int code
);
164 extern int lttng_start_tracing(char *session_name
);
166 extern int lttng_stop_tracing(char *session_name
);
168 //extern int lttng_ust_list_traceable_apps(pid_t **pids);
171 * LTTng Kernel tracer control
173 extern int lttng_kernel_add_context(struct lttng_kernel_context
*ctx
,
174 char *event_name
, char *channel_name
);
176 extern int lttng_kernel_create_channel(struct lttng_channel
*chan
);
178 extern int lttng_kernel_enable_event(struct lttng_event
*ev
, char *channel_name
);
180 extern int lttng_kernel_enable_channel(char *name
);
182 extern int lttng_kernel_disable_event(char *name
, char *channel_name
);
184 extern int lttng_kernel_disable_channel(char *name
);
186 extern int lttng_kernel_list_events(char **event_list
);
189 * LTTng User-space tracer control
192 #endif /* _LTTNG_H */