[ltt-dev] [LTTNG-MODULES PATCH 1/2] Add mmap client mode

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


Three new modules to configure the ring buffer output for mmap support.
Add the RING_BUFFER_OUTPUT macro to configure the ring buffer output
instead of being splice by default.

Signed-off-by: Julien Desfossez <julien.desfossez at polymtl.ca>
---
 Makefile                                |    3 +++
 ltt-ring-buffer-client-discard.c        |    1 +
 ltt-ring-buffer-client-mmap-discard.c   |   21 +++++++++++++++++++++
 ltt-ring-buffer-client-mmap-overwrite.c |   21 +++++++++++++++++++++
 ltt-ring-buffer-client-overwrite.c      |    1 +
 ltt-ring-buffer-client.h                |    2 +-
 ltt-ring-buffer-metadata-client.c       |    1 +
 ltt-ring-buffer-metadata-client.h       |    2 +-
 ltt-ring-buffer-metadata-mmap-client.c  |   21 +++++++++++++++++++++
 9 files changed, 71 insertions(+), 2 deletions(-)
 create mode 100644 ltt-ring-buffer-client-mmap-discard.c
 create mode 100644 ltt-ring-buffer-client-mmap-overwrite.c
 create mode 100644 ltt-ring-buffer-metadata-mmap-client.c

diff --git a/Makefile b/Makefile
index 9a0effc..1384ce4 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,9 @@ ifneq ($(CONFIG_TRACEPOINTS),)
 obj-m += ltt-ring-buffer-client-discard.o
 obj-m += ltt-ring-buffer-client-overwrite.o
 obj-m += ltt-ring-buffer-metadata-client.o
+obj-m += ltt-ring-buffer-client-mmap-discard.o
+obj-m += ltt-ring-buffer-client-mmap-overwrite.o
+obj-m += ltt-ring-buffer-metadata-mmap-client.o
 
 obj-m += ltt-relay.o
 ltt-relay-objs :=  ltt-events.o ltt-debugfs-abi.o \
diff --git a/ltt-ring-buffer-client-discard.c b/ltt-ring-buffer-client-discard.c
index ca7dfa8..e338497 100644
--- a/ltt-ring-buffer-client-discard.c
+++ b/ltt-ring-buffer-client-discard.c
@@ -13,6 +13,7 @@
 
 #define RING_BUFFER_MODE_TEMPLATE		RING_BUFFER_DISCARD
 #define RING_BUFFER_MODE_TEMPLATE_STRING	"discard"
+#define RING_BUFFER_OUTPUT 			RING_BUFFER_SPLICE
 #include "ltt-ring-buffer-client.h"
 
 MODULE_LICENSE("GPL and additional rights");
diff --git a/ltt-ring-buffer-client-mmap-discard.c b/ltt-ring-buffer-client-mmap-discard.c
new file mode 100644
index 0000000..29c2668
--- /dev/null
+++ b/ltt-ring-buffer-client-mmap-discard.c
@@ -0,0 +1,21 @@
+/*
+ * ltt-ring-buffer-client-discard.c
+ *
+ * Copyright (C) 2010 - Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * LTTng lib ring buffer client (discard mode).
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/module.h>
+#include "ltt-tracer.h"
+
+#define RING_BUFFER_MODE_TEMPLATE		RING_BUFFER_DISCARD
+#define RING_BUFFER_MODE_TEMPLATE_STRING	"discard-mmap"
+#define RING_BUFFER_OUTPUT 			RING_BUFFER_MMAP
+#include "ltt-ring-buffer-client.h"
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("LTTng Ring Buffer Client Discard Mode");
diff --git a/ltt-ring-buffer-client-mmap-overwrite.c b/ltt-ring-buffer-client-mmap-overwrite.c
new file mode 100644
index 0000000..4b965ac
--- /dev/null
+++ b/ltt-ring-buffer-client-mmap-overwrite.c
@@ -0,0 +1,21 @@
+/*
+ * ltt-ring-buffer-client-overwrite.c
+ *
+ * Copyright (C) 2010 - Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * LTTng lib ring buffer client (overwrite mode).
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/module.h>
+#include "ltt-tracer.h"
+
+#define RING_BUFFER_MODE_TEMPLATE		RING_BUFFER_OVERWRITE
+#define RING_BUFFER_MODE_TEMPLATE_STRING	"overwrite-mmap"
+#define RING_BUFFER_OUTPUT 			RING_BUFFER_MMAP
+#include "ltt-ring-buffer-client.h"
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("LTTng Ring Buffer Client Overwrite Mode");
diff --git a/ltt-ring-buffer-client-overwrite.c b/ltt-ring-buffer-client-overwrite.c
index ec3b1cf..5637cd3 100644
--- a/ltt-ring-buffer-client-overwrite.c
+++ b/ltt-ring-buffer-client-overwrite.c
@@ -13,6 +13,7 @@
 
 #define RING_BUFFER_MODE_TEMPLATE		RING_BUFFER_OVERWRITE
 #define RING_BUFFER_MODE_TEMPLATE_STRING	"overwrite"
+#define RING_BUFFER_OUTPUT 			RING_BUFFER_SPLICE
 #include "ltt-ring-buffer-client.h"
 
 MODULE_LICENSE("GPL and additional rights");
diff --git a/ltt-ring-buffer-client.h b/ltt-ring-buffer-client.h
index 6389c98..9123853 100644
--- a/ltt-ring-buffer-client.h
+++ b/ltt-ring-buffer-client.h
@@ -361,7 +361,7 @@ static const struct lib_ring_buffer_config client_config = {
 	.sync = RING_BUFFER_SYNC_PER_CPU,
 	.mode = RING_BUFFER_MODE_TEMPLATE,
 	.backend = RING_BUFFER_PAGE,
-	.output = RING_BUFFER_SPLICE,
+	.output = RING_BUFFER_OUTPUT,
 	.oops = RING_BUFFER_OOPS_CONSISTENCY,
 	.ipi = RING_BUFFER_IPI_BARRIER,
 	.wakeup = RING_BUFFER_WAKEUP_BY_TIMER,
diff --git a/ltt-ring-buffer-metadata-client.c b/ltt-ring-buffer-metadata-client.c
index 64f4408..be4455f 100644
--- a/ltt-ring-buffer-metadata-client.c
+++ b/ltt-ring-buffer-metadata-client.c
@@ -13,6 +13,7 @@
 
 #define RING_BUFFER_MODE_TEMPLATE		RING_BUFFER_DISCARD
 #define RING_BUFFER_MODE_TEMPLATE_STRING	"metadata"
+#define RING_BUFFER_OUTPUT 			RING_BUFFER_SPLICE
 #include "ltt-ring-buffer-metadata-client.h"
 
 MODULE_LICENSE("GPL and additional rights");
diff --git a/ltt-ring-buffer-metadata-client.h b/ltt-ring-buffer-metadata-client.h
index 6d92e42..bf242dd 100644
--- a/ltt-ring-buffer-metadata-client.h
+++ b/ltt-ring-buffer-metadata-client.h
@@ -142,7 +142,7 @@ static const struct lib_ring_buffer_config client_config = {
 	.sync = RING_BUFFER_SYNC_GLOBAL,
 	.mode = RING_BUFFER_MODE_TEMPLATE,
 	.backend = RING_BUFFER_PAGE,
-	.output = RING_BUFFER_SPLICE,
+	.output = RING_BUFFER_OUTPUT,
 	.oops = RING_BUFFER_OOPS_CONSISTENCY,
 	.ipi = RING_BUFFER_IPI_BARRIER,
 	.wakeup = RING_BUFFER_WAKEUP_BY_TIMER,
diff --git a/ltt-ring-buffer-metadata-mmap-client.c b/ltt-ring-buffer-metadata-mmap-client.c
new file mode 100644
index 0000000..2c5db00
--- /dev/null
+++ b/ltt-ring-buffer-metadata-mmap-client.c
@@ -0,0 +1,21 @@
+/*
+ * ltt-ring-buffer-metadata-client.c
+ *
+ * Copyright (C) 2010 - Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * LTTng lib ring buffer metadta client.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <linux/module.h>
+#include "ltt-tracer.h"
+
+#define RING_BUFFER_MODE_TEMPLATE		RING_BUFFER_DISCARD
+#define RING_BUFFER_MODE_TEMPLATE_STRING	"metadata-mmap"
+#define RING_BUFFER_OUTPUT 			RING_BUFFER_MMAP
+#include "ltt-ring-buffer-metadata-client.h"
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers");
+MODULE_DESCRIPTION("LTTng Ring Buffer Metadata Client");
-- 
1.7.4.1





More information about the lttng-dev mailing list