diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2009-02-27 23:32:58 -0500 |
|---|---|---|
| committer | Steven Rostedt <srostedt@redhat.com> | 2009-02-28 03:05:40 -0500 |
| commit | b628b3e629b1436710e59a21cc020fbb04a52ce1 (patch) | |
| tree | 43cbe737f8d81c8499c406961603e6be1e2dfc05 /kernel | |
| parent | 6ecc2d1ca39177edb6fbdb7412948b0e9f409d02 (diff) | |
tracing: make the set_event and available_events subsystem aware
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>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/trace/trace_events.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 19332200c457..b811eb343522 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
| @@ -12,6 +12,8 @@ | |||
| 12 | 12 | ||
| 13 | #include "trace_events.h" | 13 | #include "trace_events.h" |
| 14 | 14 | ||
| 15 | #define TRACE_SYSTEM "TRACE_SYSTEM" | ||
| 16 | |||
| 15 | #define events_for_each(event) \ | 17 | #define events_for_each(event) \ |
| 16 | for (event = __start_ftrace_events; \ | 18 | for (event = __start_ftrace_events; \ |
| 17 | (unsigned long)event < (unsigned long)__stop_ftrace_events; \ | 19 | (unsigned long)event < (unsigned long)__stop_ftrace_events; \ |
| @@ -45,14 +47,47 @@ static void ftrace_clear_events(void) | |||
| 45 | static int ftrace_set_clr_event(char *buf, int set) | 47 | static int ftrace_set_clr_event(char *buf, int set) |
| 46 | { | 48 | { |
| 47 | struct ftrace_event_call *call = __start_ftrace_events; | 49 | struct ftrace_event_call *call = __start_ftrace_events; |
| 50 | char *event = NULL, *sub = NULL, *match; | ||
| 51 | int ret = -EINVAL; | ||
| 52 | |||
| 53 | /* | ||
| 54 | * The buf format can be <subsystem>:<event-name> | ||
| 55 | * *:<event-name> means any event by that name. | ||
| 56 | * :<event-name> is the same. | ||
| 57 | * | ||
| 58 | * <subsystem>:* means all events in that subsystem | ||
| 59 | * <subsystem>: means the same. | ||
| 60 | * | ||
| 61 | * <name> (no ':') means all events in a subsystem with | ||
| 62 | * the name <name> or any event that matches <name> | ||
| 63 | */ | ||
| 64 | |||
| 65 | match = strsep(&buf, ":"); | ||
| 66 | if (buf) { | ||
| 67 | sub = match; | ||
| 68 | event = buf; | ||
| 69 | match = NULL; | ||
| 48 | 70 | ||
| 71 | if (!strlen(sub) || strcmp(sub, "*") == 0) | ||
| 72 | sub = NULL; | ||
| 73 | if (!strlen(event) || strcmp(event, "*") == 0) | ||
| 74 | event = NULL; | ||
| 75 | } | ||
| 49 | 76 | ||
| 50 | events_for_each(call) { | 77 | events_for_each(call) { |
| 51 | 78 | ||
| 52 | if (!call->name) | 79 | if (!call->name) |
| 53 | continue; | 80 | continue; |
| 54 | 81 | ||
| 55 | if (strcmp(buf, call->name) != 0) | 82 | if (match && |
| 83 | strcmp(match, call->name) != 0 && | ||
| 84 | strcmp(match, call->system) != 0) | ||
| 85 | continue; | ||
| 86 | |||
| 87 | if (sub && strcmp(sub, call->system) != 0) | ||
| 88 | continue; | ||
| 89 | |||
| 90 | if (event && strcmp(event, call->name) != 0) | ||
| 56 | continue; | 91 | continue; |
| 57 | 92 | ||
| 58 | if (set) { | 93 | if (set) { |
| @@ -68,9 +103,9 @@ static int ftrace_set_clr_event(char *buf, int set) | |||
| 68 | call->enabled = 0; | 103 | call->enabled = 0; |
| 69 | call->unregfunc(); | 104 | call->unregfunc(); |
| 70 | } | 105 | } |
| 71 | return 0; | 106 | ret = 0; |
| 72 | } | 107 | } |
| 73 | return -EINVAL; | 108 | return ret; |
| 74 | } | 109 | } |
| 75 | 110 | ||
| 76 | /* 128 should be much more than enough */ | 111 | /* 128 should be much more than enough */ |
| @@ -200,6 +235,8 @@ static int t_show(struct seq_file *m, void *v) | |||
| 200 | { | 235 | { |
| 201 | struct ftrace_event_call *call = v; | 236 | struct ftrace_event_call *call = v; |
| 202 | 237 | ||
| 238 | if (strcmp(call->system, TRACE_SYSTEM) != 0) | ||
| 239 | seq_printf(m, "%s:", call->system); | ||
| 203 | seq_printf(m, "%s\n", call->name); | 240 | seq_printf(m, "%s\n", call->name); |
| 204 | 241 | ||
| 205 | return 0; | 242 | return 0; |
