mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Mathieu Desnoyers <compudj@krystal.dyndns.org>,
	Tom Zanussi <tzanussi@gmail.com>,
	Masami Hiramatsu <mhiramat@redhat.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Jason Baron <jbaron@redhat.com>,
	"Frank Ch. Eigler" <fche@redhat.com>,
	acme@ghostprotocols.net, Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 03/10] tracing: make the set_event and available_events subsystem aware
Date: Sat, 28 Feb 2009 04:06:49 -0500	[thread overview]
Message-ID: <20090228090937.335053911@goodmis.org> (raw)
In-Reply-To: <20090228090646.265765024@goodmis.org>

[-- Attachment #1: 0003-tracing-make-the-set_event-and-available_events-sub.patch --]
[-- Type: text/plain, Size: 2513 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

This patch makes the event files, set_event and available_events
aware of the subsystem.

Now you can enable an entire subsystem with:

  echo 'irq:*' > set_event

Note: the '*' is not needed.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 kernel/trace/trace_events.c |   45 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 1933220..b811eb3 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -12,6 +12,8 @@
 
 #include "trace_events.h"
 
+#define TRACE_SYSTEM "TRACE_SYSTEM"
+
 #define events_for_each(event)						\
 	for (event = __start_ftrace_events;				\
 	     (unsigned long)event < (unsigned long)__stop_ftrace_events; \
@@ -45,14 +47,47 @@ static void ftrace_clear_events(void)
 static int ftrace_set_clr_event(char *buf, int set)
 {
 	struct ftrace_event_call *call = __start_ftrace_events;
+	char *event = NULL, *sub = NULL, *match;
+	int ret = -EINVAL;
+
+	/*
+	 * The buf format can be <subsystem>:<event-name>
+	 *  *:<event-name> means any event by that name.
+	 *  :<event-name> is the same.
+	 *
+	 *  <subsystem>:* means all events in that subsystem
+	 *  <subsystem>: means the same.
+	 *
+	 *  <name> (no ':') means all events in a subsystem with
+	 *  the name <name> or any event that matches <name>
+	 */
+
+	match = strsep(&buf, ":");
+	if (buf) {
+		sub = match;
+		event = buf;
+		match = NULL;
 
+		if (!strlen(sub) || strcmp(sub, "*") == 0)
+			sub = NULL;
+		if (!strlen(event) || strcmp(event, "*") == 0)
+			event = NULL;
+	}
 
 	events_for_each(call) {
 
 		if (!call->name)
 			continue;
 
-		if (strcmp(buf, call->name) != 0)
+		if (match &&
+		    strcmp(match, call->name) != 0 &&
+		    strcmp(match, call->system) != 0)
+			continue;
+
+		if (sub && strcmp(sub, call->system) != 0)
+			continue;
+
+		if (event && strcmp(event, call->name) != 0)
 			continue;
 
 		if (set) {
@@ -68,9 +103,9 @@ static int ftrace_set_clr_event(char *buf, int set)
 			call->enabled = 0;
 			call->unregfunc();
 		}
-		return 0;
+		ret = 0;
 	}
-	return -EINVAL;
+	return ret;
 }
 
 /* 128 should be much more than enough */
@@ -200,6 +235,8 @@ static int t_show(struct seq_file *m, void *v)
 {
 	struct ftrace_event_call *call = v;
 
+	if (strcmp(call->system, TRACE_SYSTEM) != 0)
+		seq_printf(m, "%s:", call->system);
 	seq_printf(m, "%s\n", call->name);
 
 	return 0;
-- 
1.5.6.5

-- 

  parent reply	other threads:[~2009-02-28  9:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-28  9:06 [PATCH 00/10] [git pull] for tip/tracing/ftrace Steven Rostedt
2009-02-28  9:06 ` [PATCH 01/10] tracing: move trace point formats to files in include/trace directory Steven Rostedt
2009-02-28  9:06 ` [PATCH 02/10] tracing: add subsystem level to trace events Steven Rostedt
2009-02-28  9:06 ` Steven Rostedt [this message]
2009-02-28  9:06 ` [PATCH 04/10] tracing: add subsystem irq for irq events Steven Rostedt
2009-02-28  9:06 ` [PATCH 05/10] tracing: add subsystem sched for sched events Steven Rostedt
2009-02-28  9:06 ` [PATCH 06/10] tracing: add interface to write into current tracer buffer Steven Rostedt
2009-02-28  9:06 ` [PATCH 07/10] tracing: add raw trace point recording infrastructure Steven Rostedt
2009-03-02  7:51   ` Tom Zanussi
2009-03-02 12:22     ` Frédéric Weisbecker
2009-03-02 13:23     ` Steven Rostedt
2009-02-28  9:06 ` [PATCH 08/10] tracing: add raw fast tracing interface for trace events Steven Rostedt
2009-02-28  9:06 ` [PATCH 09/10] tracing: create the C style tracing for the sched subsystem Steven Rostedt
2009-02-28  9:06 ` [PATCH 10/10] tracing: create the C style tracing for the irq subsystem Steven Rostedt
2009-02-28  9:17 ` [PATCH 00/10] [git pull] for tip/tracing/ftrace Ingo Molnar

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=20090228090937.335053911@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=acme@ghostprotocols.net \
    --cc=akpm@linux-foundation.org \
    --cc=compudj@krystal.dyndns.org \
    --cc=fche@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=jbaron@redhat.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=srostedt@redhat.com \
    --cc=tzanussi@gmail.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

all inboxes | Powered by JetHome®