#define LTTNG_SYM_NAME_LEN 128
enum lttng_kernel_instrumentation {
- LTTNG_KERNEL_TRACEPOINTS,
- LTTNG_KERNEL_KPROBES,
- LTTNG_KERNEL_FUNCTION,
+ LTTNG_KERNEL_TRACEPOINT = 0,
+ LTTNG_KERNEL_KPROBE = 1,
+ LTTNG_KERNEL_FUNCTION = 2,
+};
+
+/*
+ * LTTng consumer mode
+ */
+enum lttng_kernel_output {
+ LTTNG_KERNEL_SPLICE = 0,
+ LTTNG_KERNEL_MMAP = 1,
};
/*
#define DEFAULT_CHANNEL_SUBBUF_NUM 8
#define DEFAULT_CHANNEL_SWITCH_TIMER 0 /* usec */
#define DEFAULT_CHANNEL_READ_TIMER 200 /* usec */
-/* See lttng.h enum lttng_kernel_output for channel output */
+/* See lttng-kernel.h enum lttng_kernel_output for channel output */
#define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_KERNEL_SPLICE
+
+/* == NOT IMPLEMENTED ==
#define DEFAULT_UST_CHANNEL_OUTPUT LTTNG_UST_MMAP
+*/
/*
* lttng user-space instrumentation type
#define LTTNG_DEFAULT_TRACE_DIR_NAME "lttng-traces"
/*
- * Event symbol length.
+ * Event symbol length. Copied from LTTng kernel ABI.
*/
#define LTTNG_SYMBOL_NAME_LEN 128
+/*
+ * Every lttng_event_* structure both apply to kernel event and user-space
+ * event.
+ *
+ * Every lttng_kernel_* is copied from the LTTng kernel ABI.
+ */
+
enum lttng_event_type {
- LTTNG_EVENT_TRACEPOINTS,
- LTTNG_EVENT_KPROBES,
+ LTTNG_EVENT_TRACEPOINT,
+ LTTNG_EVENT_KPROBE,
LTTNG_EVENT_FUNCTION,
};
+/*
+ * LTTng consumer mode
+ */
+enum lttng_event_output {
+ /* Using splice(2) */
+ LTTNG_EVENT_SPLICE = 0,
+ /* Using mmap(2) */
+ LTTNG_EVENT_MMAP = 1,
+};
+
/* Kernel context possible type */
enum lttng_kernel_context_type {
LTTNG_KERNEL_CONTEXT_PID = 0,
} u;
};
-/*
- * LTTng consumer mode
- */
-enum lttng_kernel_output {
- LTTNG_KERNEL_SPLICE = 0,
- LTTNG_KERNEL_MMAP = 1,
-};
-
/*
* Either addr is used or symbol_name and offset.
*/
} attr;
};
-/* Tracer channel attributes */
+/*
+ * Tracer channel attributes. For both kernel and user-space.
+ */
struct lttng_channel_attr {
int overwrite; /* 1: overwrite, 0: discard */
uint64_t subbuf_size; /* bytes */
uint64_t num_subbuf; /* power of 2 */
unsigned int switch_timer_interval; /* usec */
unsigned int read_timer_interval; /* usec */
- enum lttng_kernel_output output; /* splice, mmap */
+ enum lttng_event_output output; /* splice, mmap */
};
/*
- * Basic session information.
+ * Channel information structure. For both kernel and user-space.
*/
-struct lttng_session {
+struct lttng_channel {
char name[NAME_MAX];
- char path[PATH_MAX];
+ struct lttng_channel_attr attr;
};
-/* Channel information structure */
-struct lttng_channel {
+/*
+ * Basic session information.
+ *
+ * This is an 'output data' meaning that it only comes *from* the session
+ * daemon *to* the lttng client. It's basically a 'human' representation of
+ * tracing entities (here a session).
+ */
+struct lttng_session {
char name[NAME_MAX];
- struct lttng_channel_attr attr;
+ /* The path where traces are written */
+ char path[PATH_MAX];
};
/*
extern int lttng_disconnect_sessiond(void);
-/* Return an allocated array of lttng_session */
+/*
+ * Return a "lttng_session" array. Caller must free(3) the returned data.
+ */
extern int lttng_list_sessions(struct lttng_session **sessions);
extern int lttng_session_daemon_alive(void);
extern int lttng_stop_tracing(char *session_name);
-//extern int lttng_ust_list_traceable_apps(pid_t **pids);
-
/*
* LTTng Kernel tracer control
*/
* LTTng User-space tracer control
*/
+//extern int lttng_ust_list_traceable_apps(pid_t **pids);
+
#endif /* _LTTNG_H */
if (ev == NULL) {
strncpy(ev_attr.name, event, LTTNG_SYM_NAME_LEN);
/* Default event type for enable all */
- ev_attr.type = LTTNG_EVENT_TRACEPOINTS;
+ ev_attr.type = LTTNG_EVENT_TRACEPOINT;
/* Enable each single tracepoint event */
ret = kernel_create_event(&ev_attr, chan);
if (ret < 0) {
}
switch (ev->type) {
- case LTTNG_EVENT_KPROBES:
- attr->instrumentation = LTTNG_KERNEL_KPROBES;
+ case LTTNG_EVENT_KPROBE:
+ attr->instrumentation = LTTNG_KERNEL_KPROBE;
attr->u.kprobe.addr = ev->attr.kprobe.addr;
attr->u.kprobe.offset = ev->attr.kprobe.offset;
strncpy(attr->u.kprobe.symbol_name,
strncpy(attr->u.ftrace.symbol_name,
ev->attr.ftrace.symbol_name, LTTNG_SYM_NAME_LEN);
break;
- case LTTNG_EVENT_TRACEPOINTS:
- attr->instrumentation = LTTNG_KERNEL_TRACEPOINTS;
+ case LTTNG_EVENT_TRACEPOINT:
+ attr->instrumentation = LTTNG_KERNEL_TRACEPOINT;
break;
default:
ERR("Unknown kernel instrumentation type (%d)", ev->type);
ev.type = opt_event_type;
switch (opt_event_type) {
- case LTTNG_EVENT_TRACEPOINTS:
+ case LTTNG_EVENT_TRACEPOINT:
ret = lttng_kernel_enable_event(&ev, channel_name);
if (ret < 0) {
ERR("Unable to find event %s", ev.name);
}
break;
- case LTTNG_EVENT_KPROBES:
+ case LTTNG_EVENT_KPROBE:
ret = parse_kprobe_opts(&ev, opt_kprobe);
if (ret < 0) {
ERR("Unable to parse kprobe options");
poptReadDefaultConfig(pc, 0);
/* Default event type */
- opt_event_type = LTTNG_KERNEL_TRACEPOINTS;
+ opt_event_type = LTTNG_EVENT_TRACEPOINT;
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
opt_cmd_name = poptGetOptArg(pc);
break;
case OPT_TRACEPOINT:
- opt_event_type = LTTNG_EVENT_TRACEPOINTS;
+ opt_event_type = LTTNG_EVENT_TRACEPOINT;
break;
case OPT_MARKER:
ret = CMD_NOT_IMPLEMENTED;
goto end;
case OPT_KPROBE:
- opt_event_type = LTTNG_EVENT_KPROBES;
+ opt_event_type = LTTNG_EVENT_KPROBE;
opt_kprobe = poptGetOptArg(pc);
break;
case OPT_FUNCTION: