diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-05-20 19:21:47 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-05-26 14:31:50 -0400 |
commit | 0f4fc29dd68dfab9c6ddd5d087d34a5b6818cb00 (patch) | |
tree | af3d210c8db9adcf117580c949fb708badcb520b /kernel/trace | |
parent | 62ba180e80f4194a498585ac0e4c07daa8ca08d1 (diff) |
tracing: add __print_symbolic to trace events
This patch adds __print_symbolic which is similar to __print_flags but
works for an enumeration type instead. That is, there is only a one to one
mapping between the values and the symbols. When a match is made, then
it is printed, otherwise the hex value is outputed.
[ Impact: add interface for showing symbol names in events ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace_output.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index a4840c260c89..c12d95db2f56 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -251,6 +251,31 @@ ftrace_print_flags_seq(struct trace_seq *p, const char *delim, | |||
251 | return p->buffer; | 251 | return p->buffer; |
252 | } | 252 | } |
253 | 253 | ||
254 | const char * | ||
255 | ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, | ||
256 | const struct trace_print_flags *symbol_array) | ||
257 | { | ||
258 | int i; | ||
259 | |||
260 | trace_seq_init(p); | ||
261 | |||
262 | for (i = 0; symbol_array[i].name; i++) { | ||
263 | |||
264 | if (val != symbol_array[i].mask) | ||
265 | continue; | ||
266 | |||
267 | trace_seq_puts(p, symbol_array[i].name); | ||
268 | break; | ||
269 | } | ||
270 | |||
271 | if (!p->len) | ||
272 | trace_seq_printf(p, "0x%lx", val); | ||
273 | |||
274 | trace_seq_putc(p, 0); | ||
275 | |||
276 | return p->buffer; | ||
277 | } | ||
278 | |||
254 | #ifdef CONFIG_KRETPROBES | 279 | #ifdef CONFIG_KRETPROBES |
255 | static inline const char *kretprobed(const char *name) | 280 | static inline const char *kretprobed(const char *name) |
256 | { | 281 | { |