diff options
author | Steven Rostedt <srostedt@redhat.com> | 2008-11-12 15:24:24 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-12 16:28:25 -0500 |
commit | 80e5ea4506791af206266c5921c97f11d3b17866 (patch) | |
tree | 847eb231f1c98377bdd600a801657a338cd1baa1 /kernel/trace/trace_selftest.c | |
parent | 9f029e83e968e5661d7be045bbcb620dbb909938 (diff) |
ftrace: add tracer called branch
Impact: added new branch tracer
Currently the tracing of branch profiling (unlikelys and likelys hit)
is only activated by the iter_ctrl. This patch adds a tracer called
"branch" that will just trace the branch profiling. The advantage
of adding this tracer is that it can be added to the ftrace selftests
on startup.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_selftest.c')
-rw-r--r-- | kernel/trace/trace_selftest.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c index 0728a105dcc1..24e6e075e6d6 100644 --- a/kernel/trace/trace_selftest.c +++ b/kernel/trace/trace_selftest.c | |||
@@ -13,6 +13,7 @@ static inline int trace_valid_entry(struct trace_entry *entry) | |||
13 | case TRACE_STACK: | 13 | case TRACE_STACK: |
14 | case TRACE_PRINT: | 14 | case TRACE_PRINT: |
15 | case TRACE_SPECIAL: | 15 | case TRACE_SPECIAL: |
16 | case TRACE_BRANCH: | ||
16 | return 1; | 17 | return 1; |
17 | } | 18 | } |
18 | return 0; | 19 | return 0; |
@@ -544,3 +545,25 @@ trace_selftest_startup_sysprof(struct tracer *trace, struct trace_array *tr) | |||
544 | return ret; | 545 | return ret; |
545 | } | 546 | } |
546 | #endif /* CONFIG_SYSPROF_TRACER */ | 547 | #endif /* CONFIG_SYSPROF_TRACER */ |
548 | |||
549 | #ifdef CONFIG_BRANCH_TRACER | ||
550 | int | ||
551 | trace_selftest_startup_branch(struct tracer *trace, struct trace_array *tr) | ||
552 | { | ||
553 | unsigned long count; | ||
554 | int ret; | ||
555 | |||
556 | /* start the tracing */ | ||
557 | trace->init(tr); | ||
558 | /* Sleep for a 1/10 of a second */ | ||
559 | msleep(100); | ||
560 | /* stop the tracing. */ | ||
561 | tracing_stop(); | ||
562 | /* check the trace buffer */ | ||
563 | ret = trace_test_buffer(tr, &count); | ||
564 | trace->reset(tr); | ||
565 | tracing_start(); | ||
566 | |||
567 | return ret; | ||
568 | } | ||
569 | #endif /* CONFIG_BRANCH_TRACER */ | ||