default channel selection cleanup
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 30 Jun 2011 15:18:23 +0000 (11:18 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 30 Jun 2011 15:18:23 +0000 (11:18 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng-share.h
kconsumerd/kconsumerd.c
ltt-sessiond/main.c
ltt-sessiond/trace.c
lttng/commands/add_channel.c

index cd971c355044d9351dcd42f72f9b086df8f93a12..f75ad773df8339da069a009f54adeea837497ce5 100644 (file)
@@ -30,13 +30,17 @@ typedef __s64 s64;
 #define LTTNG_RUNDIR        "/var/run/lttng"
 
 /* Default channel attributes */
-#define DEFAULT_CHANNEL_NAME                 "channel0"
-#define DEFAULT_CHANNEL_OVERWRITE            0
-#define DEFAULT_CHANNEL_SUBBUF_SIZE          4096    /* bytes */
-#define DEFAULT_CHANNEL_SUBBUF_NUM           8       /* Must always be a power of 2 */
-#define DEFAULT_CHANNEL_SWITCH_TIMER         0       /* usec */
-#define DEFAULT_CHANNEL_READ_TIMER           200     /* usec */
-#define DEFAULT_CHANNEL_OUTPUT               0       /* splice, mmap (0: SPLICE, 1: MMAP, see lttng.h) */
+#define DEFAULT_CHANNEL_NAME                   "channel0"
+#define DEFAULT_CHANNEL_OVERWRITE              0
+/* DEFAULT_CHANNEL_SUBBUF_SIZE must always be a power of 2 */
+#define DEFAULT_CHANNEL_SUBBUF_SIZE            4096    /* bytes */
+/* DEFAULT_CHANNEL_SUBBUF_NUM must always be a power of 2 */
+#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 */
+#define DEFAULT_KERNEL_CHANNEL_OUTPUT          LTTNG_KERNEL_SPLICE
+#define DEFAULT_UST_CHANNEL_OUTPUT             LTTNG_UST_MMAP
 
 /*
  * lttng user-space instrumentation type
index c816d0dece14e623ebdf3d68b60d68b3ae443466..c51e4adff535f56fc039459f41693f6e1dd6af30 100644 (file)
@@ -469,7 +469,8 @@ static int read_subbuffer(struct ltt_kconsumerd_fd *kconsumerd_fd)
                goto end;
        }
 
-       if (DEFAULT_CHANNEL_OUTPUT == LTTNG_KERNEL_SPLICE) {
+       switch (DEFAULT_KERNEL_CHANNEL_OUTPUT) {
+       case LTTNG_KERNEL_SPLICE:
                /* read the whole subbuffer */
                err = kernctl_get_padded_subbuf_size(infd, &len);
                if (err != 0) {
@@ -487,7 +488,8 @@ static int read_subbuffer(struct ltt_kconsumerd_fd *kconsumerd_fd)
                         */
                        ERR("Error splicing to tracefile");
                }
-       } else if (DEFAULT_CHANNEL_OUTPUT == LTTNG_KERNEL_MMAP) {
+               break;
+       case LTTNG_KERNEL_MMAP:
                /* read the used subbuffer size */
                err = kernctl_get_subbuf_size(infd, &len);
                if (err != 0) {
@@ -505,10 +507,10 @@ static int read_subbuffer(struct ltt_kconsumerd_fd *kconsumerd_fd)
                         */
                        ERR("Error writing to tracefile");
                }
-       } else {
+               break;
+       default:
                ERR("Unknown output method");
                ret = -1;
-               goto end;
        }
 
        err = kernctl_put_next_subbuf(infd);
index 92e41b1c6aff91b1573843079cfd3420b38dc275..2fcd923a1897d0f58b2b2f53568c83b2f526162d 100644 (file)
@@ -720,7 +720,7 @@ static struct lttng_channel *init_default_channel(void)
        chan->attr.num_subbuf = DEFAULT_CHANNEL_SUBBUF_NUM;
        chan->attr.switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
        chan->attr.read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
-       chan->attr.output = DEFAULT_CHANNEL_OUTPUT;
+       chan->attr.output = DEFAULT_KERNEL_CHANNEL_OUTPUT;
 
 error:
        return chan;
index 8b7be9215eeef9d3d8625e66e38bde3e5ccdbe23..297d04f29484087ad36c693f75f13c8db625d19b 100644 (file)
@@ -236,7 +236,7 @@ struct ltt_kernel_metadata *trace_create_kernel_metadata(void)
        chan->attr.num_subbuf = DEFAULT_CHANNEL_SUBBUF_NUM;
        chan->attr.switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
        chan->attr.read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
-       chan->attr.output = DEFAULT_CHANNEL_OUTPUT;
+       chan->attr.output = DEFAULT_KERNEL_CHANNEL_OUTPUT;
 
        /* Init metadata */
        lkm->fd = 0;
index 0cc8e4baa0b43ff2e1757d6d2e3926e62a1d6562..0fb0e25938a5bc929b9858385c3aee7944f00100 100644 (file)
@@ -144,7 +144,7 @@ static void init_channel_config(void)
        chan.attr.num_subbuf = DEFAULT_CHANNEL_SUBBUF_NUM;
        chan.attr.switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
        chan.attr.read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
-       chan.attr.output = DEFAULT_CHANNEL_OUTPUT;
+       chan.attr.output = DEFAULT_KERNEL_CHANNEL_OUTPUT;
 }
 
 /*
This page took 0.045707 seconds and 4 git commands to generate.