diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-12-07 22:14:20 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-12-13 12:34:23 -0500 |
commit | 87d9b4e1c52867a45331a9a5495f6448e0c68b23 (patch) | |
tree | dcac60fbfa60eec687d723fad780165cec5fd9b1 /include/trace | |
parent | 4819568f23a8bef0ca99b740ca60fe2450ab0aac (diff) |
tracing: Extract duplicate ftrace_raw_init_event_foo()
Use a generic trace_event_raw_init() function for all event's raw_init
callbacks (but kprobes) instead of defining the same version for each
of these.
This shrinks the kernel code:
text data bss dec hex filename
5355293 1961928 7103260 14420481 dc0a01 vmlinux.o.old
5346802 1961864 7103260 14411926 dbe896 vmlinux.o
raw_init can't be removed, because ftrace events and kprobe events
use different raw_init callbacks. Though it's possible to totally
remove raw_init, I choose to leave it as it is for now.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <4B1DC48C.7080603@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/ftrace.h | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index c4eca380204e..6055b0604c86 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -623,23 +623,12 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\ | |||
623 | * .trace = ftrace_raw_output_<call>, <-- stage 2 | 623 | * .trace = ftrace_raw_output_<call>, <-- stage 2 |
624 | * }; | 624 | * }; |
625 | * | 625 | * |
626 | * static int ftrace_raw_init_event_<call>(struct ftrace_event_call *unused) | ||
627 | * { | ||
628 | * int id; | ||
629 | * | ||
630 | * id = register_ftrace_event(&ftrace_event_type_<call>); | ||
631 | * if (!id) | ||
632 | * return -ENODEV; | ||
633 | * event_<call>.id = id; | ||
634 | * return 0; | ||
635 | * } | ||
636 | * | ||
637 | * static struct ftrace_event_call __used | 626 | * static struct ftrace_event_call __used |
638 | * __attribute__((__aligned__(4))) | 627 | * __attribute__((__aligned__(4))) |
639 | * __attribute__((section("_ftrace_events"))) event_<call> = { | 628 | * __attribute__((section("_ftrace_events"))) event_<call> = { |
640 | * .name = "<call>", | 629 | * .name = "<call>", |
641 | * .system = "<system>", | 630 | * .system = "<system>", |
642 | * .raw_init = ftrace_raw_init_event_<call>, | 631 | * .raw_init = trace_event_raw_init, |
643 | * .regfunc = ftrace_reg_event_<call>, | 632 | * .regfunc = ftrace_reg_event_<call>, |
644 | * .unregfunc = ftrace_unreg_event_<call>, | 633 | * .unregfunc = ftrace_unreg_event_<call>, |
645 | * .show_format = ftrace_format_<call>, | 634 | * .show_format = ftrace_format_<call>, |
@@ -647,9 +636,6 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\ | |||
647 | * | 636 | * |
648 | */ | 637 | */ |
649 | 638 | ||
650 | #undef TP_FMT | ||
651 | #define TP_FMT(fmt, args...) fmt "\n", ##args | ||
652 | |||
653 | #ifdef CONFIG_EVENT_PROFILE | 639 | #ifdef CONFIG_EVENT_PROFILE |
654 | 640 | ||
655 | #define _TRACE_PROFILE_INIT(call) \ | 641 | #define _TRACE_PROFILE_INIT(call) \ |
@@ -744,19 +730,7 @@ static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\ | |||
744 | \ | 730 | \ |
745 | static struct trace_event ftrace_event_type_##call = { \ | 731 | static struct trace_event ftrace_event_type_##call = { \ |
746 | .trace = ftrace_raw_output_##call, \ | 732 | .trace = ftrace_raw_output_##call, \ |
747 | }; \ | 733 | }; |
748 | \ | ||
749 | static int ftrace_raw_init_event_##call(struct ftrace_event_call *unused)\ | ||
750 | { \ | ||
751 | int id; \ | ||
752 | \ | ||
753 | id = register_ftrace_event(&ftrace_event_type_##call); \ | ||
754 | if (!id) \ | ||
755 | return -ENODEV; \ | ||
756 | event_##call.id = id; \ | ||
757 | INIT_LIST_HEAD(&event_##call.fields); \ | ||
758 | return 0; \ | ||
759 | } | ||
760 | 734 | ||
761 | #undef DEFINE_EVENT_PRINT | 735 | #undef DEFINE_EVENT_PRINT |
762 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 736 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
@@ -776,7 +750,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
776 | .name = #call, \ | 750 | .name = #call, \ |
777 | .system = __stringify(TRACE_SYSTEM), \ | 751 | .system = __stringify(TRACE_SYSTEM), \ |
778 | .event = &ftrace_event_type_##call, \ | 752 | .event = &ftrace_event_type_##call, \ |
779 | .raw_init = ftrace_raw_init_event_##call, \ | 753 | .raw_init = trace_event_raw_init, \ |
780 | .regfunc = ftrace_raw_reg_event_##call, \ | 754 | .regfunc = ftrace_raw_reg_event_##call, \ |
781 | .unregfunc = ftrace_raw_unreg_event_##call, \ | 755 | .unregfunc = ftrace_raw_unreg_event_##call, \ |
782 | .show_format = ftrace_format_##template, \ | 756 | .show_format = ftrace_format_##template, \ |
@@ -793,7 +767,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
793 | .name = #call, \ | 767 | .name = #call, \ |
794 | .system = __stringify(TRACE_SYSTEM), \ | 768 | .system = __stringify(TRACE_SYSTEM), \ |
795 | .event = &ftrace_event_type_##call, \ | 769 | .event = &ftrace_event_type_##call, \ |
796 | .raw_init = ftrace_raw_init_event_##call, \ | 770 | .raw_init = trace_event_raw_init, \ |
797 | .regfunc = ftrace_raw_reg_event_##call, \ | 771 | .regfunc = ftrace_raw_reg_event_##call, \ |
798 | .unregfunc = ftrace_raw_unreg_event_##call, \ | 772 | .unregfunc = ftrace_raw_unreg_event_##call, \ |
799 | .show_format = ftrace_format_##call, \ | 773 | .show_format = ftrace_format_##call, \ |
@@ -953,7 +927,6 @@ end: \ | |||
953 | perf_swevent_put_recursion_context(rctx); \ | 927 | perf_swevent_put_recursion_context(rctx); \ |
954 | end_recursion: \ | 928 | end_recursion: \ |
955 | local_irq_restore(irq_flags); \ | 929 | local_irq_restore(irq_flags); \ |
956 | \ | ||
957 | } | 930 | } |
958 | 931 | ||
959 | #undef DEFINE_EVENT | 932 | #undef DEFINE_EVENT |