aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_export.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-04-22 10:35:55 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-14 14:20:23 -0400
commit2e33af029556cb8bd22bf4f86f42d540249177ea (patch)
tree8a479d21300c7692d61093846054f626e3e71ed5 /kernel/trace/trace_export.c
parent2239291aeb0379fe47980b0e560e0eb9fd7e82ec (diff)
tracing: Move fields from event to class structure
Move the defined fields from the event to the class structure. Since the fields of the event are defined by the class they belong to, it makes sense to have the class hold the information instead of the individual events. The events of the same class would just hold duplicate information. After this change the size of the kernel dropped another 3K: text data bss dec hex filename 4913961 1088356 861512 6863829 68bbd5 vmlinux.orig 4900252 1057412 861512 6819176 680d68 vmlinux.regs 4900375 1053380 861512 6815267 67fe23 vmlinux.fields Although the text increased, this was mainly due to the C files having to adapt to the change. This is a constant increase, where new tracepoints will not increase the Text. But the big drop is in the data size (as well as needed allocations to hold the fields). This will give even more savings as more tracepoints are created. Note, if just TRACE_EVENT()s are used and not DECLARE_EVENT_CLASS() with several DEFINE_EVENT()s, then the savings will be lost. But we are pushing developers to consolidate events with DEFINE_EVENT() so this should not be an issue. The kprobes define a unique class to every new event, but are dynamic so it should not be a issue. The syscalls however have a single class but the fields for the individual events are different. The syscalls use a metadata to define the fields. I moved the fields list from the event to the metadata and added a "get_fields()" function to the class. This function is used to find the fields. For normal events and kprobes, get_fields() just returns a pointer to the fields list_head in the class. For syscall events, it returns the fields list_head in the metadata for the event. v2: Fixed the syscall fields. The syscall metadata needs a list of fields for both enter and exit. Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_export.c')
-rw-r--r--kernel/trace/trace_export.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 7f16e2163817..e700a0c1803f 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -18,10 +18,6 @@
18#undef TRACE_SYSTEM 18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM ftrace 19#define TRACE_SYSTEM ftrace
20 20
21struct ftrace_event_class event_class_ftrace = {
22 .system = __stringify(TRACE_SYSTEM),
23};
24
25/* not needed for this file */ 21/* not needed for this file */
26#undef __field_struct 22#undef __field_struct
27#define __field_struct(type, item) 23#define __field_struct(type, item)
@@ -131,7 +127,7 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
131 127
132static int ftrace_raw_init_event(struct ftrace_event_call *call) 128static int ftrace_raw_init_event(struct ftrace_event_call *call)
133{ 129{
134 INIT_LIST_HEAD(&call->fields); 130 INIT_LIST_HEAD(&call->class->fields);
135 return 0; 131 return 0;
136} 132}
137 133
@@ -159,15 +155,19 @@ static int ftrace_raw_init_event(struct ftrace_event_call *call)
159#undef FTRACE_ENTRY 155#undef FTRACE_ENTRY
160#define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \ 156#define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \
161 \ 157 \
158struct ftrace_event_class event_class_ftrace_##call = { \
159 .system = __stringify(TRACE_SYSTEM), \
160 .define_fields = ftrace_define_fields_##call, \
161}; \
162 \
162struct ftrace_event_call __used \ 163struct ftrace_event_call __used \
163__attribute__((__aligned__(4))) \ 164__attribute__((__aligned__(4))) \
164__attribute__((section("_ftrace_events"))) event_##call = { \ 165__attribute__((section("_ftrace_events"))) event_##call = { \
165 .name = #call, \ 166 .name = #call, \
166 .id = type, \ 167 .id = type, \
167 .class = &event_class_ftrace, \ 168 .class = &event_class_ftrace_##call, \
168 .raw_init = ftrace_raw_init_event, \ 169 .raw_init = ftrace_raw_init_event, \
169 .print_fmt = print, \ 170 .print_fmt = print, \
170 .define_fields = ftrace_define_fields_##call, \
171}; \ 171}; \
172 172
173#include "trace_entries.h" 173#include "trace_entries.h"