diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-04-23 10:00:22 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-05-14 14:20:34 -0400 |
commit | 80decc70afc57c87eee9d6b836aec2ecacba3457 (patch) | |
tree | 3aec4c67a5518a9c4e60a6914c5dbb9eb82e952f /kernel/trace | |
parent | a9a5776380208a3e48a92d0c763ee1a3b486fb73 (diff) | |
download | op-kernel-dev-80decc70afc57c87eee9d6b836aec2ecacba3457.zip op-kernel-dev-80decc70afc57c87eee9d6b836aec2ecacba3457.tar.gz |
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')
-rw-r--r-- | kernel/trace/trace_events.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_kprobe.c | 14 | ||||
-rw-r--r-- | kernel/trace/trace_syscalls.c | 8 |
3 files changed, 17 insertions, 11 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 8e94255..aafe5bf 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -122,7 +122,7 @@ int trace_event_raw_init(struct ftrace_event_call *call) { int id; - id = register_ftrace_event(call->event); + id = register_ftrace_event(&call->event); if (!id) return -ENODEV; call->id = id; @@ -1073,8 +1073,8 @@ static void remove_subsystem_dir(const char *name) static void __trace_remove_event_call(struct ftrace_event_call *call) { ftrace_event_enable_disable(call, 0); - if (call->event) - __unregister_ftrace_event(call->event); + if (call->event.funcs) + __unregister_ftrace_event(&call->event); debugfs_remove_recursive(call->dir); list_del(&call->list); trace_destroy_fields(call); diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index b989ae2..d8061c3 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -204,7 +204,6 @@ struct trace_probe { const char *symbol; /* symbol name */ struct ftrace_event_class class; struct ftrace_event_call call; - struct trace_event event; unsigned int nr_args; struct probe_arg args[]; }; @@ -1020,7 +1019,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags, int i; field = (struct kprobe_trace_entry *)iter->ent; - tp = container_of(event, struct trace_probe, event); + tp = container_of(event, struct trace_probe, call.event); if (!trace_seq_printf(s, "%s: (", tp->call.name)) goto partial; @@ -1054,7 +1053,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags, int i; field = (struct kretprobe_trace_entry *)iter->ent; - tp = container_of(event, struct trace_probe, event); + tp = container_of(event, struct trace_probe, call.event); if (!trace_seq_printf(s, "%s: (", tp->call.name)) goto partial; @@ -1364,20 +1363,19 @@ static int register_probe_event(struct trace_probe *tp) /* Initialize ftrace_event_call */ if (probe_is_return(tp)) { - tp->event.funcs = &kretprobe_funcs; INIT_LIST_HEAD(&call->class->fields); + call->event.funcs = &kretprobe_funcs; call->class->raw_init = probe_event_raw_init; call->class->define_fields = kretprobe_event_define_fields; } else { INIT_LIST_HEAD(&call->class->fields); - tp->event.funcs = &kprobe_funcs; + call->event.funcs = &kprobe_funcs; call->class->raw_init = probe_event_raw_init; call->class->define_fields = kprobe_event_define_fields; } if (set_print_fmt(tp) < 0) return -ENOMEM; - call->event = &tp->event; - call->id = register_ftrace_event(&tp->event); + call->id = register_ftrace_event(&call->event); if (!call->id) { kfree(call->print_fmt); return -ENODEV; @@ -1389,7 +1387,7 @@ static int register_probe_event(struct trace_probe *tp) if (ret) { pr_info("Failed to register kprobe event: %s\n", call->name); kfree(call->print_fmt); - unregister_ftrace_event(&tp->event); + unregister_ftrace_event(&call->event); } return ret; } diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 3751c81..7c7cfe9 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c @@ -39,6 +39,14 @@ syscall_get_exit_fields(struct ftrace_event_call *call) return &entry->exit_fields; } +struct trace_event_functions enter_syscall_print_funcs = { + .trace = print_syscall_enter, +}; + +struct trace_event_functions exit_syscall_print_funcs = { + .trace = print_syscall_exit, +}; + struct ftrace_event_class event_class_syscall_enter = { .system = "syscalls", .reg = syscall_enter_register, |