summaryrefslogtreecommitdiffstats
path: root/include/trace/trace_events.h
diff options
context:
space:
mode:
authorJeremy Linton <jeremy.linton@arm.com>2017-05-31 23:56:50 +0200
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-06-13 23:10:57 +0200
commit4f0dfd76e9cc9296d74d6d5f579a5c7ca3bed869 (patch)
treee94e913df249cfc2694942fae470da20f4a196da /include/trace/trace_events.h
parenttracing: Rename enum_replace to eval_replace (diff)
downloadlinux-4f0dfd76e9cc9296d74d6d5f579a5c7ca3bed869.tar.xz
linux-4f0dfd76e9cc9296d74d6d5f579a5c7ca3bed869.zip
tracing: define TRACE_DEFINE_SIZEOF() macro to map sizeof's to their values
Perf has a problem that if sizeof() macros are used within TRACE_EVENT() macro's they end up in userspace as "sizeof(kernel structure)" which cannot properly be parsed. Add a macro which can forward this data through the eval_map for userspace utilization. Link: http://lkml.kernel.org/r/20170531215653.3240-10-jeremy.linton@arm.com Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'include/trace/trace_events.h')
-rw-r--r--include/trace/trace_events.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
index 49cce5fb54ee..3976fa1f6e42 100644
--- a/include/trace/trace_events.h
+++ b/include/trace/trace_events.h
@@ -46,6 +46,19 @@ TRACE_MAKE_SYSTEM_STR();
__attribute__((section("_ftrace_eval_map"))) \
*TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
+#undef TRACE_DEFINE_SIZEOF
+#define TRACE_DEFINE_SIZEOF(a) \
+ static struct trace_eval_map __used __initdata \
+ __##TRACE_SYSTEM##_##a = \
+ { \
+ .system = TRACE_SYSTEM_STRING, \
+ .eval_string = "sizeof(" #a ")", \
+ .eval_value = sizeof(a) \
+ }; \
+ static struct trace_eval_map __used \
+ __attribute__((section("_ftrace_eval_map"))) \
+ *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
+
/*
* DECLARE_EVENT_CLASS can be used to add a generic function
* handlers for events. That is, if all events have the same
@@ -158,6 +171,9 @@ TRACE_MAKE_SYSTEM_STR();
#undef TRACE_DEFINE_ENUM
#define TRACE_DEFINE_ENUM(a)
+#undef TRACE_DEFINE_SIZEOF
+#define TRACE_DEFINE_SIZEOF(a)
+
#undef __field
#define __field(type, item)