Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140822
b: refs/heads/master
c: b628b3e
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt committed Feb 28, 2009
1 parent ea9beb3 commit 5a7b4bf
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6ecc2d1ca39177edb6fbdb7412948b0e9f409d02
refs/heads/master: b628b3e629b1436710e59a21cc020fbb04a52ce1
43 changes: 40 additions & 3 deletions trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down Expand Up @@ -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) {
Expand All @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5a7b4bf

Please sign in to comment.