diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-06-30 22:47:05 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-07-01 09:44:24 -0400 |
commit | 020e5f85cb087a40572c8b8b2dd06292a14fa212 (patch) | |
tree | d1bd09885693dd9d5e9db995cb0f7f58aa0e1bb8 /kernel/trace/trace_events.c | |
parent | c5cb5a2d8d7dc872cf1504091ad0e59fe5ff7cb5 (diff) |
tracing/events: Add trace_event boot option
We already have ftrace= boot option, and this adds a similar
boot option for trace events, so allow trace events to be
enabled at boot, for boot debugging purpose.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4A4ACE29.3010407@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r-- | kernel/trace/trace_events.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 53c8fd376a88..fecac1314cbe 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/ctype.h> | 17 | #include <linux/ctype.h> |
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | 19 | ||
20 | #include <asm/setup.h> | ||
21 | |||
20 | #include "trace_output.h" | 22 | #include "trace_output.h" |
21 | 23 | ||
22 | #define TRACE_SYSTEM "TRACE_SYSTEM" | 24 | #define TRACE_SYSTEM "TRACE_SYSTEM" |
@@ -1133,6 +1135,18 @@ struct notifier_block trace_module_nb = { | |||
1133 | extern struct ftrace_event_call __start_ftrace_events[]; | 1135 | extern struct ftrace_event_call __start_ftrace_events[]; |
1134 | extern struct ftrace_event_call __stop_ftrace_events[]; | 1136 | extern struct ftrace_event_call __stop_ftrace_events[]; |
1135 | 1137 | ||
1138 | static char bootup_event_buf[COMMAND_LINE_SIZE] __initdata; | ||
1139 | |||
1140 | static __init int setup_trace_event(char *str) | ||
1141 | { | ||
1142 | strlcpy(bootup_event_buf, str, COMMAND_LINE_SIZE); | ||
1143 | ring_buffer_expanded = 1; | ||
1144 | tracing_selftest_disabled = 1; | ||
1145 | |||
1146 | return 1; | ||
1147 | } | ||
1148 | __setup("trace_event=", setup_trace_event); | ||
1149 | |||
1136 | static __init int event_trace_init(void) | 1150 | static __init int event_trace_init(void) |
1137 | { | 1151 | { |
1138 | struct ftrace_event_call *call; | 1152 | struct ftrace_event_call *call; |
@@ -1140,6 +1154,8 @@ static __init int event_trace_init(void) | |||
1140 | struct dentry *entry; | 1154 | struct dentry *entry; |
1141 | struct dentry *d_events; | 1155 | struct dentry *d_events; |
1142 | int ret; | 1156 | int ret; |
1157 | char *buf = bootup_event_buf; | ||
1158 | char *token; | ||
1143 | 1159 | ||
1144 | d_tracer = tracing_init_dentry(); | 1160 | d_tracer = tracing_init_dentry(); |
1145 | if (!d_tracer) | 1161 | if (!d_tracer) |
@@ -1185,6 +1201,19 @@ static __init int event_trace_init(void) | |||
1185 | &ftrace_event_format_fops); | 1201 | &ftrace_event_format_fops); |
1186 | } | 1202 | } |
1187 | 1203 | ||
1204 | while (true) { | ||
1205 | token = strsep(&buf, ","); | ||
1206 | |||
1207 | if (!token) | ||
1208 | break; | ||
1209 | if (!*token) | ||
1210 | continue; | ||
1211 | |||
1212 | ret = ftrace_set_clr_event(token, 1); | ||
1213 | if (ret) | ||
1214 | pr_warning("Failed to enable trace event: %s\n", token); | ||
1215 | } | ||
1216 | |||
1188 | ret = register_module_notifier(&trace_module_nb); | 1217 | ret = register_module_notifier(&trace_module_nb); |
1189 | if (ret) | 1218 | if (ret) |
1190 | pr_warning("Failed to register trace events module notifier\n"); | 1219 | pr_warning("Failed to register trace events module notifier\n"); |
@@ -1392,10 +1421,10 @@ static __init void event_trace_self_test_with_function(void) | |||
1392 | 1421 | ||
1393 | static __init int event_trace_self_tests_init(void) | 1422 | static __init int event_trace_self_tests_init(void) |
1394 | { | 1423 | { |
1395 | 1424 | if (!tracing_selftest_disabled) { | |
1396 | event_trace_self_tests(); | 1425 | event_trace_self_tests(); |
1397 | 1426 | event_trace_self_test_with_function(); | |
1398 | event_trace_self_test_with_function(); | 1427 | } |
1399 | 1428 | ||
1400 | return 0; | 1429 | return 0; |
1401 | } | 1430 | } |