extern int lttng_ust_start_trace(pid_t pid);
extern int lttng_ust_stop_trace(pid_t pid);
+/*
+ * Kernel tracer control
+ */
+extern int lttng_kernel_enable_event(char *event_name);
+extern int lttng_kernel_disable_event(char *event_name);
+extern int lttng_kernel_create_session(void);
+extern int lttng_kernel_start_tracing(void);
+extern int lttng_kernel_stop_tracing(void);
+extern int lttng_kernel_create_channel(int overwrite,
+ uint64_t subbuf_size, uint64_t num_subbuf,
+ unsigned int switch_timer_interval,
+ unsigned int read_timer_interval);
+
#endif /* _LIBLTTNGCTL_H */
return ret;
}
+/*
+ * BEGIN KERNEL CONTROL
+ */
+
+/*
+ * lttng_kernel_enable_event
+ *
+ * Enable an event in the kernel tracer.
+ */
+int lttng_kernel_enable_event(char *event_name)
+{
+ strncpy(lsm.u.event.event_name, event_name, NAME_MAX);
+ return ask_sessiond(KERNEL_ENABLE_EVENT, NULL);
+}
+
+/*
+ * lttng_kernel_disable_event
+ *
+ * Disable an event in the kernel tracer.
+ */
+int lttng_kernel_disable_event(char *event_name)
+{
+ strncpy(lsm.u.event.event_name, event_name, NAME_MAX);
+ return ask_sessiond(KERNEL_DISABLE_EVENT, NULL);
+}
+
+/*
+ * lttng_kernel_create_session
+ *
+ * Create a session in the kernel tracer.
+ */
+int lttng_kernel_create_session(void)
+{
+ return ask_sessiond(KERNEL_CREATE_SESSION, NULL);
+}
+
+/*
+ * lttng_kernel_create_channel
+ *
+ * Create a channel in the kernel tracer.
+ */
+int lttng_kernel_create_channel(int overwrite,
+ u64 subbuf_size, u64 num_subbuf,
+ unsigned int switch_timer_interval,
+ unsigned int read_timer_interval)
+{
+ /* Write setting to the session message */
+ lsm.u.create_channel.overwrite = overwrite;
+ lsm.u.create_channel.subbuf_size = subbuf_size;
+ lsm.u.create_channel.num_subbuf = num_subbuf;
+ lsm.u.create_channel.switch_timer_interval = switch_timer_interval;
+ lsm.u.create_channel.read_timer_interval = read_timer_interval;
+
+ return ask_sessiond(KERNEL_CREATE_CHANNEL, NULL);
+}
+
+/*
+ * lttng_kernel_start_tracing
+ *
+ * Start kernel tracing.
+ */
+int lttng_kernel_start_tracing(void)
+{
+ return ask_sessiond(KERNEL_START_TRACE, NULL);
+}
+
+/*
+ * lttng_kernel_stop_tracing
+ *
+ * Stop kernel tracing.
+ */
+int lttng_kernel_stop_tracing(void)
+{
+ return ask_sessiond(KERNEL_STOP_TRACE, NULL);
+}
+
+/*
+ * END KERNEL CONTROL
+ */
+
/*
* lttng_get_readable_code
*
#define LTTCOMM_ERR_INDEX(code) (code - LTTCOMM_OK)
enum lttcomm_sessiond_command {
+ KERNEL_CREATE_CHANNEL,
+ KERNEL_CREATE_SESSION,
+ KERNEL_DISABLE_EVENT,
+ KERNEL_ENABLE_EVENT,
+ KERNEL_START_TRACE,
+ KERNEL_STOP_TRACE,
LTTNG_CREATE_SESSION,
LTTNG_DESTROY_SESSION,
LTTNG_FORCE_SUBBUF_SWITCH,
} create_session;
/* Marker data */
struct {
- char channel[NAME_MAX];
- char marker[NAME_MAX];
- } marker;
- /* SET_SOCK_PATH */
+ char event_name[NAME_MAX];
+ } event;
+ /* Create channel kernel */
struct {
- char sock_path[PATH_MAX];
- } sock_path;
- /* SET_SUBBUF_NUM */
- struct {
- unsigned int subbuf_num;
- char channel[NAME_MAX];
- } subbuf_num;
- /* SET_SUBBUF_SIZE */
- struct {
- unsigned int subbuf_size;
- char channel[NAME_MAX];
- } subbuf_size;
+ int overwrite;
+ u64 subbuf_size;
+ u64 num_subbuf;
+ unsigned int switch_timer_interval;
+ unsigned int read_timer_interval;
+ } create_channel;
} u;
};