diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2013-06-20 11:44:44 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-06-21 01:24:32 -0400 |
commit | f5abaa1bfc3dbf26d19d3513f39279ca369f8d65 (patch) | |
tree | b3b5151c021486b65b0f01f5f4d1cfb94b82d1f9 /include | |
parent | 7d132055814ef17a6c7b69f342244c410a5e000f (diff) |
tracing: Add DEFINE_EVENT_FN() macro
Each TRACE_EVENT() adds several helper functions. If two or more trace events
share the same structure and print format, they can also share most of these
helper functions and save a lot of space from duplicate code. This is why the
DECLARE_EVENT_CLASS() and DEFINE_EVENT() were created.
Some events require a trigger to be called at registering and unregistering of
the event and to do so they use TRACE_EVENT_FN().
If multiple events require a trigger, they currently have no choice but to use
TRACE_EVENT_FN() as there's no DEFINE_EVENT_FN() available. This unfortunately
causes a lot of wasted duplicate code created.
By adding a DEFINE_EVENT_FN(), these events can still use a
DECLARE_EVENT_CLASS() and then define their own triggers.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/51C3236C.8030508@hds.com
Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/tracepoint.h | 2 | ||||
-rw-r--r-- | include/trace/define_trace.h | 5 | ||||
-rw-r--r-- | include/trace/ftrace.h | 4 |
3 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index f8e084d0fc77..ebeab360d851 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -378,6 +378,8 @@ static inline void tracepoint_synchronize_unregister(void) | |||
378 | #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) | 378 | #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) |
379 | #define DEFINE_EVENT(template, name, proto, args) \ | 379 | #define DEFINE_EVENT(template, name, proto, args) \ |
380 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 380 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
381 | #define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)\ | ||
382 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | ||
381 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 383 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
382 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 384 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
383 | #define DEFINE_EVENT_CONDITION(template, name, proto, \ | 385 | #define DEFINE_EVENT_CONDITION(template, name, proto, \ |
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index 1905ca8dd399..02e1003568a4 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h | |||
@@ -44,6 +44,10 @@ | |||
44 | #define DEFINE_EVENT(template, name, proto, args) \ | 44 | #define DEFINE_EVENT(template, name, proto, args) \ |
45 | DEFINE_TRACE(name) | 45 | DEFINE_TRACE(name) |
46 | 46 | ||
47 | #undef DEFINE_EVENT_FN | ||
48 | #define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \ | ||
49 | DEFINE_TRACE_FN(name, reg, unreg) | ||
50 | |||
47 | #undef DEFINE_EVENT_PRINT | 51 | #undef DEFINE_EVENT_PRINT |
48 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 52 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
49 | DEFINE_TRACE(name) | 53 | DEFINE_TRACE(name) |
@@ -91,6 +95,7 @@ | |||
91 | #undef TRACE_EVENT_CONDITION | 95 | #undef TRACE_EVENT_CONDITION |
92 | #undef DECLARE_EVENT_CLASS | 96 | #undef DECLARE_EVENT_CLASS |
93 | #undef DEFINE_EVENT | 97 | #undef DEFINE_EVENT |
98 | #undef DEFINE_EVENT_FN | ||
94 | #undef DEFINE_EVENT_PRINT | 99 | #undef DEFINE_EVENT_PRINT |
95 | #undef DEFINE_EVENT_CONDITION | 100 | #undef DEFINE_EVENT_CONDITION |
96 | #undef TRACE_HEADER_MULTI_READ | 101 | #undef TRACE_HEADER_MULTI_READ |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 19edd7facaa1..d615f78cc6b6 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -71,6 +71,10 @@ | |||
71 | static struct ftrace_event_call __used \ | 71 | static struct ftrace_event_call __used \ |
72 | __attribute__((__aligned__(4))) event_##name | 72 | __attribute__((__aligned__(4))) event_##name |
73 | 73 | ||
74 | #undef DEFINE_EVENT_FN | ||
75 | #define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \ | ||
76 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | ||
77 | |||
74 | #undef DEFINE_EVENT_PRINT | 78 | #undef DEFINE_EVENT_PRINT |
75 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 79 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
76 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) | 80 | DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) |