summaryrefslogtreecommitdiff
path: root/include/trace/define_trace.h
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-11-19 04:27:27 +0300
committerSteven Rostedt <rostedt@goodmis.org>2009-11-25 01:52:11 +0300
commitff038f5c37c2070829004a0678372766c2b32180 (patch)
tree69a48d73eb959ae3c9be3814c42e37a8ea188c41 /include/trace/define_trace.h
parentfa7c27ee9394fc0d52404b2a89882e95868a60b9 (diff)
downloadlinux-ff038f5c37c2070829004a0678372766c2b32180.tar.xz
tracing: Create new TRACE_EVENT_TEMPLATE
There are some places in the kernel that define several tracepoints and they are all identical besides the name. The code to enable, disable and record is created for every trace point even if most of the code is identical. This patch adds TRACE_EVENT_TEMPLATE that lets the developer create a template TRACE_EVENT and create trace points with DEFINE_EVENT, which is based off of a given template. Each trace point used by this will share most of the code, and bring down the size of the kernel when there are several duplicate events. Usage is: TRACE_EVENT_TEMPLATE(name, proto, args, tstruct, assign, print); Which would be the same as defining a normal TRACE_EVENT. To create the trace events that the trace points will use: DEFINE_EVENT(template, name, proto, args) is done. The template is the name of the TRACE_EVENT_TEMPLATE to use. The name is the name of the trace point. The parameters proto and args must be the same as the proto and args of the template. If they are not the same, then a compile error will result. I tried hard removing this duplication but the C preprocessor is not powerful enough (or my CPP magic experience points is not at a high enough level) to not need them. A lot of trace events are coming in with new XFS development. Most of the trace points are identical except for the name. The following shows the advantage of having TRACE_EVENT_TEMPLATE: $ size fs/xfs/xfs.o.* text data bss dec hex filename 452114 2788 3520 458422 6feb6 fs/xfs/xfs.o.old 638482 38116 3744 680342 a6196 fs/xfs/xfs.o.template 996954 38116 4480 1039550 fdcbe fs/xfs/xfs.o.trace xfs.o.old is without any tracepoints. xfs.o.template uses the new TRACE_EVENT_TEMPLATE. xfs.o.trace uses the current TRACE_EVENT macros. Requested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/trace/define_trace.h')
-rw-r--r--include/trace/define_trace.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 2a4b3bf74033..244985814a43 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -31,6 +31,10 @@
assign, print, reg, unreg) \
DEFINE_TRACE_FN(name, reg, unreg)
+#undef DEFINE_EVENT
+#define DEFINE_EVENT(template, name, proto, args) \
+ DEFINE_TRACE(name)
+
#undef DECLARE_TRACE
#define DECLARE_TRACE(name, proto, args) \
DEFINE_TRACE(name)
@@ -63,6 +67,8 @@
#undef TRACE_EVENT
#undef TRACE_EVENT_FN
+#undef TRACE_EVENT_TEMPLATE
+#undef DEFINE_EVENT
#undef TRACE_HEADER_MULTI_READ
/* Only undef what we defined in this file */