[ltt-dev] [LTTNG-MODULES PATCH 2/2] Update ABI to select the output method

Julien Desfossez julien.desfossez at polymtl.ca
Wed Jun 29 15:53:21 EDT 2011


Add output selection in lttng_kernel_channel to use mmap or splice.

Signed-off-by: Julien Desfossez <julien.desfossez at polymtl.ca>
---
 ltt-debugfs-abi.c |   19 ++++++++++++++++---
 ltt-debugfs-abi.h |    9 +++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/ltt-debugfs-abi.c b/ltt-debugfs-abi.c
index 6327d09..e6dd4ec 100644
--- a/ltt-debugfs-abi.c
+++ b/ltt-debugfs-abi.c
@@ -289,12 +289,25 @@ int lttng_abi_create_channel(struct file *session_file,
 	}
 	switch (channel_type) {
 	case PER_CPU_CHANNEL:
-		transport_name = chan_param.overwrite ?
-			"relay-overwrite" : "relay-discard";
+		if (chan_param.output == LTTNG_KERNEL_SPLICE) {
+			transport_name = chan_param.overwrite ?
+				"relay-overwrite" : "relay-discard";
+		} else if (chan_param.output == LTTNG_KERNEL_MMAP) {
+		    transport_name = chan_param.overwrite ?
+			"relay-overwrite-mmap" : "relay-discard-mmap";
+		}
 		fops = &lttng_channel_fops;
 		break;
 	case METADATA_CHANNEL:
-		transport_name = "relay-metadata";
+		if (chan_param.output == LTTNG_KERNEL_SPLICE) {
+			printk("selecting splice output method for metadata\n");
+			transport_name = "relay-metadata";
+		} else if (chan_param.output == LTTNG_KERNEL_MMAP) {
+			printk("selecting mmap output method for metadata\n");
+		    transport_name = "relay-metadata-mmap";
+		} else {
+			printk("selecting WTF output method for metadata\n");
+		}
 		fops = &lttng_metadata_fops;
 		break;
 	default:
diff --git a/ltt-debugfs-abi.h b/ltt-debugfs-abi.h
index e3a7160..e333655 100644
--- a/ltt-debugfs-abi.h
+++ b/ltt-debugfs-abi.h
@@ -22,6 +22,14 @@ enum lttng_kernel_instrumentation {
 };
 
 /*
+ * LTTng consumer mode
+ */
+enum lttng_kernel_output {
+	LTTNG_KERNEL_SPLICE,
+	LTTNG_KERNEL_MMAP,
+};
+
+/*
  * LTTng DebugFS ABI structures.
  */
 
@@ -31,6 +39,7 @@ struct lttng_kernel_channel {
 	uint64_t num_subbuf;
 	unsigned int switch_timer_interval;	/* usecs */
 	unsigned int read_timer_interval;	/* usecs */
+	enum lttng_kernel_output output;	/* splice, mmap */
 };
 
 /*
-- 
1.7.4.1





More information about the lttng-dev mailing list