aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_branch.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_branch.c')
-rw-r--r--kernel/trace/trace_branch.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
index 6c00feb3bac7..c15222a01073 100644
--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -14,7 +14,9 @@
14#include <linux/hash.h> 14#include <linux/hash.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <asm/local.h> 16#include <asm/local.h>
17
17#include "trace.h" 18#include "trace.h"
19#include "trace_output.h"
18 20
19#ifdef CONFIG_BRANCH_TRACER 21#ifdef CONFIG_BRANCH_TRACER
20 22
@@ -142,6 +144,49 @@ static void branch_trace_reset(struct trace_array *tr)
142 stop_branch_trace(tr); 144 stop_branch_trace(tr);
143} 145}
144 146
147static int
148trace_print_print(struct trace_seq *s, struct trace_entry *entry, int flags)
149{
150 struct print_entry *field;
151
152 trace_assign_type(field, entry);
153
154 if (seq_print_ip_sym(s, field->ip, flags))
155 goto partial;
156
157 if (trace_seq_printf(s, ": %s", field->buf))
158 goto partial;
159
160 partial:
161 return TRACE_TYPE_PARTIAL_LINE;
162}
163
164static int
165trace_branch_print(struct trace_seq *s, struct trace_entry *entry, int flags)
166{
167 struct trace_branch *field;
168
169 trace_assign_type(field, entry);
170
171 if (trace_seq_printf(s, "[%s] %s:%s:%d\n",
172 field->correct ? " ok " : " MISS ",
173 field->func,
174 field->file,
175 field->line))
176 return TRACE_TYPE_PARTIAL_LINE;
177
178 return 0;
179}
180
181static struct trace_event trace_branch_event = {
182 .type = TRACE_BRANCH,
183 .trace = trace_branch_print,
184 .latency_trace = trace_branch_print,
185 .raw = trace_nop_print,
186 .hex = trace_nop_print,
187 .binary = trace_nop_print,
188};
189
145struct tracer branch_trace __read_mostly = 190struct tracer branch_trace __read_mostly =
146{ 191{
147 .name = "branch", 192 .name = "branch",
@@ -154,6 +199,14 @@ struct tracer branch_trace __read_mostly =
154 199
155__init static int init_branch_trace(void) 200__init static int init_branch_trace(void)
156{ 201{
202 int ret;
203
204 ret = register_ftrace_event(&trace_branch_event);
205 if (!ret) {
206 printk(KERN_WARNING "Warning: could not register branch events\n");
207 return 1;
208 }
209
157 return register_tracer(&branch_trace); 210 return register_tracer(&branch_trace);
158} 211}
159 212