aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-05-20 19:21:47 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-05-26 14:31:50 -0400
commit0f4fc29dd68dfab9c6ddd5d087d34a5b6818cb00 (patch)
treeaf3d210c8db9adcf117580c949fb708badcb520b /include
parent62ba180e80f4194a498585ac0e4c07daa8ca08d1 (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 'include')
-rw-r--r--include/linux/ftrace_event.h3
-rw-r--r--include/trace/ftrace.h8
2 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 4b58cf1a11c2..bbf40f624fc8 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -20,6 +20,9 @@ const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
20 unsigned long flags, 20 unsigned long flags,
21 const struct trace_print_flags *flag_array); 21 const struct trace_print_flags *flag_array);
22 22
23const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
24 const struct trace_print_flags *symbol_array);
25
23/* 26/*
24 * The trace entry - the most basic unit of tracing. This is what 27 * The trace entry - the most basic unit of tracing. This is what
25 * is printed in the end as a single line in the trace output, such as: 28 * is printed in the end as a single line in the trace output, such as:
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 22c94719c569..87fc227c6fbe 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -130,6 +130,14 @@
130 ftrace_print_flags_seq(p, delim, flag, flags); \ 130 ftrace_print_flags_seq(p, delim, flag, flags); \
131 }) 131 })
132 132
133#undef __print_symbolic
134#define __print_symbolic(value, symbol_array...) \
135 ({ \
136 static const struct trace_print_flags symbols[] = \
137 { symbol_array, { -1, NULL }}; \
138 ftrace_print_symbols_seq(p, value, symbols); \
139 })
140
133#undef TRACE_EVENT 141#undef TRACE_EVENT
134#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ 142#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
135enum print_line_t \ 143enum print_line_t \