aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_selftest.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-02-07 15:33:57 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-09 04:51:37 -0500
commit7447dce96f2233d250bc39a4a10a42f7c3dd46fc (patch)
treec02c991cca658e69a0c83c1a93b068df1d5caa53 /kernel/trace/trace_selftest.c
parent2db270a80b8f2238e536876cfb3987af02684df8 (diff)
tracing/function-graph-tracer: provide a selftest for the function graph tracer
Making it more easy to do a basic regression test for this tracer. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_selftest.c')
-rw-r--r--kernel/trace/trace_selftest.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 445700e51f6d..0c9aa1457e51 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -13,6 +13,8 @@ static inline int trace_valid_entry(struct trace_entry *entry)
13 case TRACE_PRINT: 13 case TRACE_PRINT:
14 case TRACE_SPECIAL: 14 case TRACE_SPECIAL:
15 case TRACE_BRANCH: 15 case TRACE_BRANCH:
16 case TRACE_GRAPH_ENT:
17 case TRACE_GRAPH_RET:
16 return 1; 18 return 1;
17 } 19 }
18 return 0; 20 return 0;
@@ -227,6 +229,54 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr)
227} 229}
228#endif /* CONFIG_FUNCTION_TRACER */ 230#endif /* CONFIG_FUNCTION_TRACER */
229 231
232
233#ifdef CONFIG_FUNCTION_GRAPH_TRACER
234/*
235 * Pretty much the same than for the function tracer from which the selftest
236 * has been borrowed.
237 */
238int
239trace_selftest_startup_function_graph(struct tracer *trace,
240 struct trace_array *tr)
241{
242 int ret;
243 unsigned long count;
244
245 ret = tracer_init(trace, tr);
246 if (ret) {
247 warn_failed_init_tracer(trace, ret);
248 goto out;
249 }
250
251 /* Sleep for a 1/10 of a second */
252 msleep(100);
253
254 tracing_stop();
255
256 /* check the trace buffer */
257 ret = trace_test_buffer(tr, &count);
258
259 trace->reset(tr);
260 tracing_start();
261
262 if (!ret && !count) {
263 printk(KERN_CONT ".. no entries found ..");
264 ret = -1;
265 goto out;
266 }
267
268 /* Don't test dynamic tracing, the function tracer already did */
269
270out:
271 /* Stop it if we failed */
272 if (ret)
273 ftrace_graph_stop();
274
275 return ret;
276}
277#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
278
279
230#ifdef CONFIG_IRQSOFF_TRACER 280#ifdef CONFIG_IRQSOFF_TRACER
231int 281int
232trace_selftest_startup_irqsoff(struct tracer *trace, struct trace_array *tr) 282trace_selftest_startup_irqsoff(struct tracer *trace, struct trace_array *tr)