Remove libustctl and libustcomm
[lttng-tools.git] / include / lttng / lttng.h
CommitLineData
826d496d 1/*
b7384347
DG
2 * lttng.h
3 *
4 * Linux Trace Toolkit Control Library Header File
5 *
826d496d 6 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
fac6795d
DG
7 *
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.
12 *
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.
17 *
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.
fac6795d
DG
21 */
22
b7384347
DG
23#ifndef _LTTNG_H
24#define _LTTNG_H
fac6795d 25
f3ed775e
DG
26#include <asm/types.h>
27#include <stdint.h>
57167058
DG
28#include <limits.h>
29
b7384347
DG
30/* Default unix group name for tracing. */
31#define LTTNG_DEFAULT_TRACING_GROUP "tracing"
fac6795d 32
b7384347 33/* Environment variable to set session daemon binary path. */
5b8719f5
DG
34#define LTTNG_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH"
35
58a97671
DG
36/* Default trace output directory name */
37#define LTTNG_DEFAULT_TRACE_DIR_NAME "lttng-traces"
38
b7384347 39/*
f3ed775e 40 * Event symbol length.
1657e9bb 41 */
f3ed775e
DG
42#define LTTNG_SYMBOL_NAME_LEN 128
43
44enum lttng_event_type {
45 LTTNG_EVENT_TRACEPOINTS,
46 LTTNG_EVENT_KPROBES,
47 LTTNG_EVENT_FUNCTION,
1657e9bb
DG
48};
49
d65106b1
DG
50/* Kernel context possible type */
51enum 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,
62};
63
64/* Perf counter attributes */
65struct lttng_kernel_perf_counter_ctx {
66 uint32_t type;
67 uint64_t config;
68 char name[LTTNG_SYMBOL_NAME_LEN];
69};
70
71/* Event/Channel context */
72struct lttng_kernel_context {
73 enum lttng_kernel_context_type ctx;
74 union {
75 struct lttng_kernel_perf_counter_ctx perf_counter;
76 } u;
77};
78
b9f1dd69
JD
79/*
80 * LTTng consumer mode
81 */
82enum lttng_kernel_output {
83 LTTNG_KERNEL_SPLICE = 0,
84 LTTNG_KERNEL_MMAP = 1,
85};
86
b7384347 87/*
f3ed775e 88 * Either addr is used or symbol_name and offset.
57167058 89 */
f3ed775e
DG
90struct lttng_event_kprobe_attr {
91 uint64_t addr;
92
93 uint64_t offset;
94 char symbol_name[LTTNG_SYMBOL_NAME_LEN];
57167058
DG
95};
96
b7384347 97/*
f3ed775e
DG
98 * Function tracer
99 */
100struct lttng_event_function_attr {
101 char symbol_name[LTTNG_SYMBOL_NAME_LEN];
102};
103
104/*
105 * Generic lttng event
106 */
107struct lttng_event {
108 char name[LTTNG_SYMBOL_NAME_LEN];
109 enum lttng_event_type type;
110 /* Per event type configuration */
111 union {
112 struct lttng_event_kprobe_attr kprobe;
113 struct lttng_event_function_attr ftrace;
114 } attr;
115};
116
117/* Tracer channel attributes */
118struct lttng_channel_attr {
8ce37aa5
DG
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 */
f3ed775e
DG
125};
126
127/*
128 * Basic session information.
1657e9bb 129 */
b7384347 130struct lttng_session {
1657e9bb 131 char name[NAME_MAX];
f3ed775e
DG
132 char path[PATH_MAX];
133};
134
135/* Channel information structure */
136struct lttng_channel {
137 char name[NAME_MAX];
138 struct lttng_channel_attr attr;
1657e9bb
DG
139};
140
b7384347
DG
141/*
142 * Session daemon control
143 */
b7384347 144extern int lttng_connect_sessiond(void);
f3ed775e
DG
145
146extern int lttng_create_session(char *name, char *path);
147
148extern int lttng_destroy_session(char *name);
149
87378cf5 150extern int lttng_disconnect_sessiond(void);
f3ed775e 151
b7384347 152/* Return an allocated array of lttng_session */
ca95a216 153extern int lttng_list_sessions(struct lttng_session **sessions);
f3ed775e 154
947308c4 155extern int lttng_session_daemon_alive(void);
f3ed775e 156
b7384347
DG
157/* Set tracing group for the current execution */
158extern int lttng_set_tracing_group(const char *name);
f3ed775e
DG
159
160extern void lttng_set_session_name(char *name);
161
b7384347
DG
162extern const char *lttng_get_readable_code(int code);
163
f3ed775e
DG
164extern int lttng_start_tracing(char *session_name);
165
166extern int lttng_stop_tracing(char *session_name);
167
168//extern int lttng_ust_list_traceable_apps(pid_t **pids);
169
b7384347 170/*
f3ed775e 171 * LTTng Kernel tracer control
b7384347 172 */
d65106b1
DG
173extern int lttng_kernel_add_context(struct lttng_kernel_context *ctx,
174 char *event_name, char *channel_name);
175
f3ed775e
DG
176extern int lttng_kernel_create_channel(struct lttng_channel *chan);
177
178extern int lttng_kernel_enable_event(struct lttng_event *ev, char *channel_name);
179
180extern int lttng_kernel_enable_channel(char *name);
181
182extern int lttng_kernel_disable_event(char *name, char *channel_name);
183
184extern int lttng_kernel_disable_channel(char *name);
185
186extern int lttng_kernel_list_events(char **event_list);
fac6795d 187
1df4dedd 188/*
f3ed775e 189 * LTTng User-space tracer control
1df4dedd 190 */
1df4dedd 191
b7384347 192#endif /* _LTTNG_H */
This page took 0.045509 seconds and 4 git commands to generate.