[ltt-dev] [PATCH 1/2] Move ltt_trace_struct.channels[].overwrite to ltt_trace_struct.channels[].flags

Zhaolei zhaolei at cn.fujitsu.com
Tue Dec 2 06:21:31 EST 2008


So we can save many attribute bits in it.
For support new "ENABLED" bit.

Signed-off-by: Zhao lei <zhaolei at cn.fujitsu.com>
---
 include/linux/ltt-tracer.h |    5 ++++-
 ltt/ltt-tracer.c           |   10 ++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/linux/ltt-tracer.h b/include/linux/ltt-tracer.h
index 32aad93..a18edd1 100644
--- a/include/linux/ltt-tracer.h
+++ b/include/linux/ltt-tracer.h
@@ -223,6 +223,9 @@ enum ltt_channels {
 
 enum trace_mode { LTT_TRACE_NORMAL, LTT_TRACE_FLIGHT, LTT_TRACE_HYBRID };
 
+#define CHANNEL_FLAG_ENABLE	(1U<<0)
+#define CHANNEL_FLAG_OVERWRITE	(1U<<1)
+
 /* Per-trace information - each trace/flight recorder represented by one */
 struct ltt_trace_struct {
 	/* First 32 bytes cache-hot cacheline */
@@ -245,7 +248,7 @@ struct ltt_trace_struct {
 		struct {
 			unsigned subbuf_size;
 			unsigned subbuf_cnt;
-			unsigned overwrite;
+			unsigned flags;
 		} channels[NR_LTT_CHANNELS];
 	} setting;
 	u32 freq_scale;
diff --git a/ltt/ltt-tracer.c b/ltt/ltt-tracer.c
index 41408f3..341074d 100644
--- a/ltt/ltt-tracer.c
+++ b/ltt/ltt-tracer.c
@@ -568,7 +568,12 @@ int ltt_trace_set_channel_overwrite(const char *trace_name,
 		goto traces_error;
 	}
 
-	trace->setting.channels[channel].overwrite = !!overwrite;
+	if (overwrite)
+		trace->setting.channels[channel].flags |=
+			CHANNEL_FLAG_OVERWRITE;
+	else
+		trace->setting.channels[channel].flags &=
+			~CHANNEL_FLAG_OVERWRITE;
 
 traces_error:
 	ltt_unlock_traces();
@@ -650,7 +655,8 @@ int ltt_trace_alloc(const char *trace_name)
 				+ chan_infos[chan].channel_index),
 				subbuf_size,
 				subbuf_cnt,
-				trace->setting.channels[chan].overwrite);
+				trace->setting.channels[chan].flags
+					& CHANNEL_FLAG_OVERWRITE);
 		if (err != 0) {
 			printk(KERN_ERR	"LTT : Can't create channel %s.\n",
 				chan_infos[chan].name);
-- 
1.5.5.3






More information about the lttng-dev mailing list