Skip to contentSkip to conversation

tracing: add an option for disabling markers

PATCH In review Mandeep Singh Baines 1 participant 2 messages Sep 8, 2012 – Sep 27, 2012 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: add an option for disabling markers

In our application, we have trace markers spread through user-space. We have markers in GL, X, etc. These are super handy for Chrome's about:tracing feature (Chrome + system + kernel trace view), but can be very distracting when you're trying to debug a kernel issue.

I normally, use "grep -v tracing_mark_write" but it would be nice if I could just temporarily disable markers all together.

CC Steven Rostedt <[email protected]>
CC Frederic Weisbecker <[email protected]>
CC Ingo Molnar <[email protected]>
---
 kernel/trace/trace.c |    6 +++++-
 kernel/trace/trace.h |    1 +
 2 files changed, 6 insertions(+), 1 deletions(-)
kernel/trace/trace.c +5 -1
index 5c38c81..0b052da 100644
@@ -328,7 +328,7 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
 unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
 	TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME |
 	TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE |
-	TRACE_ITER_IRQ_INFO;
+	TRACE_ITER_IRQ_INFO | TRACE_ITER_MARKERS;
 
 static int trace_stop_count;
 static DEFINE_RAW_SPINLOCK(tracing_start_lock);
@@ -470,6 +470,7 @@ static const char *trace_options[] = {
 	"overwrite",
 	"disable_on_free",
 	"irq-info",
+	"markers",
 	NULL
 };
 
@@ -3886,6 +3887,9 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
 	if (tracing_disabled)
 		return -EINVAL;
 
+	if (!(trace_flags & TRACE_ITER_MARKERS))
+		return -EINVAL;
+
 	if (cnt > TRACE_BUF_SIZE)
 		cnt = TRACE_BUF_SIZE;
 
kernel/trace/trace.h +1 -0
index 55e1f7f..3da9da0 100644
@@ -680,6 +680,7 @@ enum trace_iterator_flags {
 	TRACE_ITER_OVERWRITE		= 0x200000,
 	TRACE_ITER_STOP_ON_FREE		= 0x400000,
 	TRACE_ITER_IRQ_INFO		= 0x800000,
+	TRACE_ITER_MARKERS		= 0x1000000,
 };
 
 /*
Signature · 1 line
1.7.8.6
#1 lore raw

[tip:perf/core] tracing: Add an option for disabling markers

Commit-ID:  5224c3a31549f1c056039545b289e1b01ed02f12
Gitweb:     http://git.kernel.org/tip/5224c3a31549f1c056039545b289e1b01ed02f12
Author:     Mandeep Singh Baines <[email protected]>
AuthorDate: Fri, 7 Sep 2012 18:12:19 -0700
Committer:  Steven Rostedt <[email protected]>
CommitDate: Mon, 24 Sep 2012 14:10:44 -0400

tracing: Add an option for disabling markers

In our application, we have trace markers spread through user-space. We have markers in GL, X, etc. These are super handy for Chrome's about:tracing feature (Chrome + system + kernel trace view), but can be very distracting when you're trying to debug a kernel issue.

I normally, use "grep -v tracing_mark_write" but it would be nice if I could just temporarily disable markers all together.

---
 kernel/trace/trace.c |    6 +++++-
 kernel/trace/trace.h |    1 +
 2 files changed, 6 insertions(+), 1 deletions(-)
kernel/trace/trace.c +5 -1
index 08acf42..1ec5c1d 100644
@@ -328,7 +328,7 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
 unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
 	TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME |
 	TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE |
-	TRACE_ITER_IRQ_INFO;
+	TRACE_ITER_IRQ_INFO | TRACE_ITER_MARKERS;
 
 static int trace_stop_count;
 static DEFINE_RAW_SPINLOCK(tracing_start_lock);
@@ -470,6 +470,7 @@ static const char *trace_options[] = {
 	"overwrite",
 	"disable_on_free",
 	"irq-info",
+	"markers",
 	NULL
 };
 
@@ -3886,6 +3887,9 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
 	if (tracing_disabled)
 		return -EINVAL;
 
+	if (!(trace_flags & TRACE_ITER_MARKERS))
+		return -EINVAL;
+
 	if (cnt > TRACE_BUF_SIZE)
 		cnt = TRACE_BUF_SIZE;
 
kernel/trace/trace.h +1 -0
index 593debe..63a2da0 100644
@@ -680,6 +680,7 @@ enum trace_iterator_flags {
 	TRACE_ITER_OVERWRITE		= 0x200000,
 	TRACE_ITER_STOP_ON_FREE		= 0x400000,
 	TRACE_ITER_IRQ_INFO		= 0x800000,
+	TRACE_ITER_MARKERS		= 0x1000000,
 };
 
 /*