Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: zhaolei@cn.fujitsu.com (Zhaolei)
Subject: [ltt-dev] [PATCH 1/2] Move ltt_trace_struct.channels[].overwrite to ltt_trace_struct.channels[].flags
Date: Tue, 02 Dec 2008 19:21:31 +0800	[thread overview]
Message-ID: <49351A3B.50207@cn.fujitsu.com> (raw)
In-Reply-To: <49351A0F.5060500@cn.fujitsu.com>

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





  reply	other threads:[~2008-12-02 11:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-02 11:20 [ltt-dev] [PATCH 0/2] Make lttng support enable/disable trace channel Zhaolei
2008-12-02 11:21 ` Zhaolei [this message]
2008-12-02 11:22 ` [ltt-dev] [PATCH 2/2] Make ltt support enable/disable each channel Zhaolei
2008-12-02 17:06   ` Mathieu Desnoyers
2008-12-03  0:46     ` Zhaolei
2008-12-03  5:35       ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49351A3B.50207@cn.fujitsu.com \
    --to=zhaolei@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox