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_unlikely.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_unlikely.c')
-rw-r--r-- | kernel/trace/trace_unlikely.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/kernel/trace/trace_unlikely.c b/kernel/trace/trace_unlikely.c index e5d5969853a3..85265553918f 100644 --- a/kernel/trace/trace_unlikely.c +++ b/kernel/trace/trace_unlikely.c | |||
@@ -114,6 +114,48 @@ void disable_branch_tracing(void) | |||
114 | out_unlock: | 114 | out_unlock: |
115 | mutex_unlock(&branch_tracing_mutex); | 115 | mutex_unlock(&branch_tracing_mutex); |
116 | } | 116 | } |
117 | |||
118 | static void start_branch_trace(struct trace_array *tr) | ||
119 | { | ||
120 | enable_branch_tracing(tr); | ||
121 | } | ||
122 | |||
123 | static void stop_branch_trace(struct trace_array *tr) | ||
124 | { | ||
125 | disable_branch_tracing(); | ||
126 | } | ||
127 | |||
128 | static void branch_trace_init(struct trace_array *tr) | ||
129 | { | ||
130 | int cpu; | ||
131 | |||
132 | for_each_online_cpu(cpu) | ||
133 | tracing_reset(tr, cpu); | ||
134 | |||
135 | start_branch_trace(tr); | ||
136 | } | ||
137 | |||
138 | static void branch_trace_reset(struct trace_array *tr) | ||
139 | { | ||
140 | stop_branch_trace(tr); | ||
141 | } | ||
142 | |||
143 | struct tracer branch_trace __read_mostly = | ||
144 | { | ||
145 | .name = "branch", | ||
146 | .init = branch_trace_init, | ||
147 | .reset = branch_trace_reset, | ||
148 | #ifdef CONFIG_FTRACE_SELFTEST | ||
149 | .selftest = trace_selftest_startup_branch, | ||
150 | #endif | ||
151 | }; | ||
152 | |||
153 | __init static int init_branch_trace(void) | ||
154 | { | ||
155 | return register_tracer(&branch_trace); | ||
156 | } | ||
157 | |||
158 | device_initcall(init_branch_trace); | ||
117 | #else | 159 | #else |
118 | static inline | 160 | static inline |
119 | void trace_likely_condition(struct ftrace_branch_data *f, int val, int expect) | 161 | void trace_likely_condition(struct ftrace_branch_data *f, int val, int expect) |