Add disable kernel channel support
[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
b7384347 36/*
f3ed775e 37 * Event symbol length.
1657e9bb 38 */
f3ed775e
DG
39#define LTTNG_SYMBOL_NAME_LEN 128
40
41enum lttng_event_type {
42 LTTNG_EVENT_TRACEPOINTS,
43 LTTNG_EVENT_KPROBES,
44 LTTNG_EVENT_FUNCTION,
1657e9bb
DG
45};
46
b7384347 47/*
f3ed775e 48 * Either addr is used or symbol_name and offset.
57167058 49 */
f3ed775e
DG
50struct lttng_event_kprobe_attr {
51 uint64_t addr;
52
53 uint64_t offset;
54 char symbol_name[LTTNG_SYMBOL_NAME_LEN];
57167058
DG
55};
56
b7384347 57/*
f3ed775e
DG
58 * Function tracer
59 */
60struct lttng_event_function_attr {
61 char symbol_name[LTTNG_SYMBOL_NAME_LEN];
62};
63
64/*
65 * Generic lttng event
66 */
67struct lttng_event {
68 char name[LTTNG_SYMBOL_NAME_LEN];
69 enum lttng_event_type type;
70 /* Per event type configuration */
71 union {
72 struct lttng_event_kprobe_attr kprobe;
73 struct lttng_event_function_attr ftrace;
74 } attr;
75};
76
77/* Tracer channel attributes */
78struct lttng_channel_attr {
79 int overwrite; /* 1: overwrite, 0: discard */
80 uint64_t subbuf_size; /* bytes */
81 uint64_t num_subbuf; /* power of 2 */
82 unsigned int switch_timer_interval; /* usec */
83 unsigned int read_timer_interval; /* usec */
84};
85
86/*
87 * Basic session information.
1657e9bb 88 */
b7384347 89struct lttng_session {
1657e9bb 90 char name[NAME_MAX];
f3ed775e
DG
91 char path[PATH_MAX];
92};
93
94/* Channel information structure */
95struct lttng_channel {
96 char name[NAME_MAX];
97 struct lttng_channel_attr attr;
1657e9bb
DG
98};
99
b7384347
DG
100/*
101 * Session daemon control
102 */
b7384347 103extern int lttng_connect_sessiond(void);
f3ed775e
DG
104
105extern int lttng_create_session(char *name, char *path);
106
107extern int lttng_destroy_session(char *name);
108
87378cf5 109extern int lttng_disconnect_sessiond(void);
f3ed775e 110
b7384347 111/* Return an allocated array of lttng_session */
ca95a216 112extern int lttng_list_sessions(struct lttng_session **sessions);
f3ed775e 113
947308c4 114extern int lttng_session_daemon_alive(void);
f3ed775e 115
b7384347
DG
116/* Set tracing group for the current execution */
117extern int lttng_set_tracing_group(const char *name);
f3ed775e
DG
118
119extern void lttng_set_session_name(char *name);
120
b7384347
DG
121extern const char *lttng_get_readable_code(int code);
122
f3ed775e
DG
123extern int lttng_start_tracing(char *session_name);
124
125extern int lttng_stop_tracing(char *session_name);
126
127//extern int lttng_ust_list_traceable_apps(pid_t **pids);
128
b7384347 129/*
f3ed775e 130 * LTTng Kernel tracer control
b7384347 131 */
f3ed775e
DG
132extern int lttng_kernel_create_channel(struct lttng_channel *chan);
133
134extern int lttng_kernel_enable_event(struct lttng_event *ev, char *channel_name);
135
136extern int lttng_kernel_enable_channel(char *name);
137
138extern int lttng_kernel_disable_event(char *name, char *channel_name);
139
140extern int lttng_kernel_disable_channel(char *name);
141
142extern int lttng_kernel_list_events(char **event_list);
fac6795d 143
1df4dedd 144/*
f3ed775e 145 * LTTng User-space tracer control
1df4dedd 146 */
1df4dedd 147
b7384347 148#endif /* _LTTNG_H */
This page took 0.029804 seconds and 4 git commands to generate.