aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_kprobe.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-04-23 10:00:22 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-14 14:20:34 -0400
commit80decc70afc57c87eee9d6b836aec2ecacba3457 (patch)
tree3aec4c67a5518a9c4e60a6914c5dbb9eb82e952f /kernel/trace/trace_kprobe.c
parenta9a5776380208a3e48a92d0c763ee1a3b486fb73 (diff)
tracing: Move print functions into event class
Currently, every event has its own trace_event structure. This is fine since the structure is needed anyway. But the print function structure (trace_event_functions) is now separate. Since the output of the trace event is done by the class (with the exception of events defined by DEFINE_EVENT_PRINT), it makes sense to have the class define the print functions that all events in the class can use. This makes a bigger deal with the syscall events since all syscall events use the same class. The savings here is another 30K. text data bss dec hex filename 4913961 1088356 861512 6863829 68bbd5 vmlinux.orig 4900382 1048964 861512 6810858 67ecea vmlinux.init 4900446 1049028 861512 6810986 67ed6a vmlinux.preprint 4895024 1023812 861512 6780348 6775bc vmlinux.print To accomplish this, and to let the class know what event is being printed, the event structure is embedded in the ftrace_event_call structure. This should not be an issues since the event structure was created for each event anyway. Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_kprobe.c')
-rw-r--r--kernel/trace/trace_kprobe.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index b989ae229a20..d8061c3e02c9 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -204,7 +204,6 @@ struct trace_probe {
204 const char *symbol; /* symbol name */ 204 const char *symbol; /* symbol name */
205 struct ftrace_event_class class; 205 struct ftrace_event_class class;
206 struct ftrace_event_call call; 206 struct ftrace_event_call call;
207 struct trace_event event;
208 unsigned int nr_args; 207 unsigned int nr_args;
209 struct probe_arg args[]; 208 struct probe_arg args[];
210}; 209};
@@ -1020,7 +1019,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags,
1020 int i; 1019 int i;
1021 1020
1022 field = (struct kprobe_trace_entry *)iter->ent; 1021 field = (struct kprobe_trace_entry *)iter->ent;
1023 tp = container_of(event, struct trace_probe, event); 1022 tp = container_of(event, struct trace_probe, call.event);
1024 1023
1025 if (!trace_seq_printf(s, "%s: (", tp->call.name)) 1024 if (!trace_seq_printf(s, "%s: (", tp->call.name))
1026 goto partial; 1025 goto partial;
@@ -1054,7 +1053,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags,
1054 int i; 1053 int i;
1055 1054
1056 field = (struct kretprobe_trace_entry *)iter->ent; 1055 field = (struct kretprobe_trace_entry *)iter->ent;
1057 tp = container_of(event, struct trace_probe, event); 1056 tp = container_of(event, struct trace_probe, call.event);
1058 1057
1059 if (!trace_seq_printf(s, "%s: (", tp->call.name)) 1058 if (!trace_seq_printf(s, "%s: (", tp->call.name))
1060 goto partial; 1059 goto partial;
@@ -1364,20 +1363,19 @@ static int register_probe_event(struct trace_probe *tp)
1364 1363
1365 /* Initialize ftrace_event_call */ 1364 /* Initialize ftrace_event_call */
1366 if (probe_is_return(tp)) { 1365 if (probe_is_return(tp)) {
1367 tp->event.funcs = &kretprobe_funcs;
1368 INIT_LIST_HEAD(&call->class->fields); 1366 INIT_LIST_HEAD(&call->class->fields);
1367 call->event.funcs = &kretprobe_funcs;
1369 call->class->raw_init = probe_event_raw_init; 1368 call->class->raw_init = probe_event_raw_init;
1370 call->class->define_fields = kretprobe_event_define_fields; 1369 call->class->define_fields = kretprobe_event_define_fields;
1371 } else { 1370 } else {
1372 INIT_LIST_HEAD(&call->class->fields); 1371 INIT_LIST_HEAD(&call->class->fields);
1373 tp->event.funcs = &kprobe_funcs; 1372 call->event.funcs = &kprobe_funcs;
1374 call->class->raw_init = probe_event_raw_init; 1373 call->class->raw_init = probe_event_raw_init;
1375 call->class->define_fields = kprobe_event_define_fields; 1374 call->class->define_fields = kprobe_event_define_fields;
1376 } 1375 }
1377 if (set_print_fmt(tp) < 0) 1376 if (set_print_fmt(tp) < 0)
1378 return -ENOMEM; 1377 return -ENOMEM;
1379 call->event = &tp->event; 1378 call->id = register_ftrace_event(&call->event);
1380 call->id = register_ftrace_event(&tp->event);
1381 if (!call->id) { 1379 if (!call->id) {
1382 kfree(call->print_fmt); 1380 kfree(call->print_fmt);
1383 return -ENODEV; 1381 return -ENODEV;
@@ -1389,7 +1387,7 @@ static int register_probe_event(struct trace_probe *tp)
1389 if (ret) { 1387 if (ret) {
1390 pr_info("Failed to register kprobe event: %s\n", call->name); 1388 pr_info("Failed to register kprobe event: %s\n", call->name);
1391 kfree(call->print_fmt); 1389 kfree(call->print_fmt);
1392 unregister_ftrace_event(&tp->event); 1390 unregister_ftrace_event(&call->event);
1393 } 1391 }
1394 return ret; 1392 return ret;
1395} 1393}