| 1 | /* |
| 2 | * lttng.h |
| 3 | * |
| 4 | * Linux Trace Toolkit Control Library Header File |
| 5 | * |
| 6 | * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca> |
| 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. |
| 21 | */ |
| 22 | |
| 23 | #ifndef _LTTNG_H |
| 24 | #define _LTTNG_H |
| 25 | |
| 26 | #include <limits.h> |
| 27 | #include <uuid/uuid.h> |
| 28 | |
| 29 | /* Default unix group name for tracing. */ |
| 30 | #define LTTNG_DEFAULT_TRACING_GROUP "tracing" |
| 31 | |
| 32 | /* Environment variable to set session daemon binary path. */ |
| 33 | #define LTTNG_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH" |
| 34 | |
| 35 | /* |
| 36 | * Trace type for lttng_trace. |
| 37 | */ |
| 38 | enum lttng_trace_type { |
| 39 | KERNEL, |
| 40 | USERSPACE, |
| 41 | }; |
| 42 | |
| 43 | /* |
| 44 | * Basic trace information exposed. |
| 45 | */ |
| 46 | struct lttng_trace { |
| 47 | char name[NAME_MAX]; |
| 48 | pid_t pid; /* Only useful for user-space trace */ |
| 49 | enum lttng_trace_type type; |
| 50 | }; |
| 51 | |
| 52 | /* |
| 53 | * Basic session information exposed. |
| 54 | */ |
| 55 | struct lttng_session { |
| 56 | char name[NAME_MAX]; |
| 57 | uuid_t uuid; |
| 58 | }; |
| 59 | |
| 60 | /* |
| 61 | * Session daemon control |
| 62 | */ |
| 63 | extern int lttng_connect_sessiond(void); |
| 64 | extern int lttng_create_session(char *name); |
| 65 | extern int lttng_destroy_session(uuid_t *uuid); |
| 66 | extern int lttng_disconnect_sessiond(void); |
| 67 | /* Return an allocated array of lttng_session */ |
| 68 | extern int lttng_list_sessions(struct lttng_session **sessions); |
| 69 | /* Return an allocated array of lttng_traces */ |
| 70 | extern int lttng_list_traces(uuid_t *uuid, struct lttng_trace **traces); |
| 71 | extern int lttng_session_daemon_alive(void); |
| 72 | /* Set tracing group for the current execution */ |
| 73 | extern int lttng_set_tracing_group(const char *name); |
| 74 | /* Set session uuid for the current execution */ |
| 75 | extern void lttng_set_current_session_uuid(uuid_t *uuid); |
| 76 | extern const char *lttng_get_readable_code(int code); |
| 77 | |
| 78 | /* |
| 79 | * User-space tracer control |
| 80 | */ |
| 81 | extern int lttng_ust_create_trace(pid_t pid); |
| 82 | /* Return an allocated array of pids */ |
| 83 | extern int lttng_ust_list_apps(pid_t **pids); |
| 84 | extern int lttng_ust_start_trace(pid_t pid); |
| 85 | extern int lttng_ust_stop_trace(pid_t pid); |
| 86 | |
| 87 | /* |
| 88 | * Kernel tracer control |
| 89 | */ |
| 90 | extern int lttng_kernel_create_channel(void); |
| 91 | extern int lttng_kernel_create_session(void); |
| 92 | extern int lttng_kernel_create_stream(void); |
| 93 | extern int lttng_kernel_disable_event(char *event_name); |
| 94 | extern int lttng_kernel_enable_event(char *event_name); |
| 95 | extern int lttng_kernel_list_events(char **event_list); |
| 96 | extern int lttng_kernel_open_metadata(void); |
| 97 | extern int lttng_kernel_start_tracing(void); |
| 98 | extern int lttng_kernel_stop_tracing(void); |
| 99 | |
| 100 | #endif /* _LTTNG_H */ |