Import kernel control interface
authorDavid Goulet <david.goulet@polymtl.ca>
Wed, 18 May 2011 16:06:02 +0000 (12:06 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Wed, 18 May 2011 16:06:02 +0000 (12:06 -0400)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
include/lttng/lttng.h
liblttngctl/liblttngctl.c
liblttsessiondcomm/liblttsessiondcomm.h

index e393397f335ed492a98bbf3d96097a6de18e2be7..39a6cbdad383241ad0adf93744d1833bbc8a7b5f 100644 (file)
@@ -73,4 +73,17 @@ extern int lttng_ust_create_trace(pid_t pid);
 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 */
index e400775eaa97a6ffcd983cf4f6cd14da695ec18b..a2934e63c9644e3e70ae3b7309880b4857e9b2bd 100644 (file)
@@ -158,6 +158,86 @@ end:
        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
  *
index 8b505eb980f3ea6782ec0cef60083c2f2549f4d0..4e86cc5475b6a11804079ac3344a453e61a8a6d6 100644 (file)
 #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,
@@ -134,23 +140,16 @@ struct lttcomm_session_msg {
                } 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;
 };
 
This page took 0.036248 seconds and 4 git commands to generate.