]> git.karo-electronics.de Git - linux-beck.git/commitdiff
tracing: Give system name a pointer
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Tue, 31 Mar 2015 18:37:12 +0000 (14:37 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 8 Apr 2015 13:39:55 +0000 (09:39 -0400)
Normally the compiler will use the same pointer for a string throughout
the file. But there's no guarantee of that happening. Later changes will
require that all events have the same pointer to the system string.

Name the system string and have all events point to it.

Testing this, it did not increases the size of the text, except for the
notes section, which should not harm the real size any.

Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
include/linux/ftrace_event.h
include/trace/ftrace.h

index c674ee8f7fca508c24f172a72e8c055b8fc4ec24..62b8fac7ded5bb359d7cc369af15cdddfef9935e 100644 (file)
@@ -202,7 +202,7 @@ enum trace_reg {
 struct ftrace_event_call;
 
 struct ftrace_event_class {
-       char                    *system;
+       const char              *system;
        void                    *probe;
 #ifdef CONFIG_PERF_EVENTS
        void                    *perf_probe;
index 41bf65f04dd9e501fa4e3066402232553a19fef4..2f9b95b6d3fb92f7cc150dadcba34ce6f7a754a6 100644 (file)
 
 #include <linux/ftrace_event.h>
 
+#ifndef TRACE_SYSTEM_VAR
+#define TRACE_SYSTEM_VAR TRACE_SYSTEM
+#endif
+
+#define __app__(x, y) str__##x##y
+#define __app(x, y) __app__(x, y)
+
+#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
+
+#define TRACE_MAKE_SYSTEM_STR()                                \
+       static const char TRACE_SYSTEM_STRING[] =       \
+               __stringify(TRACE_SYSTEM)
+
+TRACE_MAKE_SYSTEM_STR();
+
 /*
  * DECLARE_EVENT_CLASS can be used to add a generic function
  * handlers for events. That is, if all events have the same
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-
 /*
  * Stage 2 of the trace events.
  *
@@ -692,7 +706,7 @@ static inline void ftrace_test_probe_##call(void)                   \
 _TRACE_PERF_PROTO(call, PARAMS(proto));                                        \
 static const char print_fmt_##call[] = print;                          \
 static struct ftrace_event_class __used __refdata event_class_##call = { \
-       .system                 = __stringify(TRACE_SYSTEM),            \
+       .system                 = TRACE_SYSTEM_STRING,                  \
        .define_fields          = ftrace_define_fields_##call,          \
        .fields                 = LIST_HEAD_INIT(event_class_##call.fields),\
        .raw_init               = trace_event_raw_init,                 \
@@ -735,6 +749,7 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
+#undef TRACE_SYSTEM_VAR
 
 #ifdef CONFIG_PERF_EVENTS