[ltt-dev] [PATCH 10/13] implement text output framework

Lai Jiangshan laijs at cn.fujitsu.com
Tue Jan 13 04:09:36 EST 2009


introduce simple framework for text output for lttng.

Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
 b/include/linux/ltt-tracer.h |   45 +++++++++++++++++++++++++++++++++++++++++++
 b/ltt/Kconfig                |    3 ++
 include/linux/ltt-channels.h |    3 ++
 3 files changed, 51 insertions(+)
diff --git a/include/linux/ltt-channels.h b/include/linux/ltt-channels.h
index 4a3924b..db513cb 100644
--- a/include/linux/ltt-channels.h
+++ b/include/linux/ltt-channels.h
@@ -10,6 +10,7 @@
 #include <linux/limits.h>
 #include <linux/kref.h>
 #include <linux/list.h>
+#include <linux/fs.h>
 
 #define EVENTS_PER_CHANNEL	65536
 
@@ -21,6 +22,7 @@ struct ltt_channel_struct {
 	struct ltt_trace_struct	*trace;
 	void *buf;
 	void *trans_channel_data;
+	atomic_t channel_disabled;
 	int overwrite:1;
 	int active:1;
 	unsigned int n_subbufs_order;
@@ -45,6 +48,7 @@ struct ltt_channel_struct {
 	void (*buffer_end) (struct rchan_buf *buf,
 			u64 tsc, unsigned int offset, unsigned int subbuf_idx);
 	struct kref kref;	/* Channel transport reference count */
+	struct dentry *txt_entry;
 	struct ltt_channel_buf_access_ops *buf_access_ops;
 	unsigned int subbuf_size;
 	unsigned int subbuf_cnt;
diff --git a/include/linux/ltt-tracer.h b/include/linux/ltt-tracer.h
index ece6819..b49cac2 100644
--- a/include/linux/ltt-tracer.h
+++ b/include/linux/ltt-tracer.h
@@ -20,6 +20,7 @@
 #include <linux/ltt-core.h>
 #include <linux/marker.h>
 #include <linux/trace-clock.h>
+#include <linux/debugfs.h>
 #include <asm/atomic.h>
 #include <asm/local.h>
 
@@ -212,6 +216,7 @@ struct ltt_trace_struct {
 	struct ltt_channel_setting *settings;
 	struct {
 		struct dentry			*trace_root;
+		struct dentry			*txt_root;
 	} dentry;
 	struct rchan_callbacks callbacks;
 	struct kref kref; /* Each channel has a kref of the trace struct */
@@ -712,6 +786,49 @@ void ltt_unlock_traces(void);
 
 extern void ltt_dump_softirq_vec(void *call_data);
 
+#ifdef CONFIG_LTT_TEXT_OUTPUT
+struct dentry *ltt_txt_create(struct ltt_trace_struct *trace,
+		struct ltt_channel_struct *ltt_channel);
+void ltt_txt_remove(struct ltt_channel_struct *ltt_channel, struct dentry *txt);
+extern struct dentry *ltt_txt_dir_dentry;
+
+static inline int ltt_txt_create_dir(struct ltt_trace_struct *new_trace)
+{
+	new_trace->dentry.txt_root = debugfs_create_dir(new_trace->trace_name,
+			ltt_txt_dir_dentry);
+	if (!new_trace->dentry.txt_root)
+		return -EEXIST;
+	return 0;
+}
+
+static inline void ltt_txt_remove_dir(struct ltt_trace_struct *trace)
+{
+	debugfs_remove(trace->dentry.txt_root);
+}
+
+#else
+static inline struct dentry *ltt_txt_create(struct ltt_trace_struct *trace,
+		struct ltt_channel_struct *ltt_channel)
+{
+	return (struct dentry *)1;
+}
+
+static inline
+void ltt_txt_remove(struct ltt_channel_struct *ltt_channel, struct dentry *txt)
+{
+}
+
+static inline int ltt_txt_create_dir(struct ltt_trace_struct *trace)
+{
+	return 0;
+}
+
+static inline void ltt_txt_remove_dir(struct ltt_trace_struct *trace)
+{
+}
+
+#endif
+
 #ifdef CONFIG_HAVE_LTT_DUMP_TABLES
 extern void ltt_dump_sys_call_table(void *call_data);
 extern void ltt_dump_idt_table(void *call_data);
diff --git a/ltt/Kconfig b/ltt/Kconfig
index 36548b5..91f2f05 100644
--- a/ltt/Kconfig
+++ b/ltt/Kconfig
@@ -65,6 +65,9 @@ config LTT_RELAY_LOCKED
 	  Support using the slow spinlock and interrupt disable algorithm to log
 	  the data obtained through LTT.
 
+config LTT_TEXT_OUTPUT
+	def_bool n
+
 config LTT_RELAY_CHECK_RANDOM_ACCESS
 	bool "Debug check for random access in ltt relay buffers"
 	depends on LTT_RELAY







More information about the lttng-dev mailing list