diff options
author | Adrian Bunk <bunk@kernel.org> | 2008-07-25 04:45:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:27 -0400 |
commit | b03f6489f9f27dc519a4c60ebf39cc7b8a58eae7 (patch) | |
tree | 6329fc91e860f2949d737c611aa846eb2d653103 /include/linux | |
parent | 696adfe84c11c571a1e0863460ff0ec142b4e5a9 (diff) |
build kernel/profile.o only when requested
Build kernel/profile.o only if CONFIG_PROFILING is enabled.
This makes CONFIG_PROFILING=n kernels smaller.
As a bonus, some profile_tick() calls and one branch from schedule() are
now eliminated with CONFIG_PROFILING=n (but I doubt these are
measurable effects).
This patch changes the effects of CONFIG_PROFILING=n, but I don't think
having more than two choices would be the better choice.
This patch also adds the name of the first parameter to the prototypes
of profile_{hits,tick}() since I anyway had to add them for the dummy
functions.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/profile.h | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/include/linux/profile.h b/include/linux/profile.h index 05c1cc736937..4081fa31081f 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h | |||
@@ -8,8 +8,6 @@ | |||
8 | 8 | ||
9 | #include <asm/errno.h> | 9 | #include <asm/errno.h> |
10 | 10 | ||
11 | extern int prof_on __read_mostly; | ||
12 | |||
13 | #define CPU_PROFILING 1 | 11 | #define CPU_PROFILING 1 |
14 | #define SCHED_PROFILING 2 | 12 | #define SCHED_PROFILING 2 |
15 | #define SLEEP_PROFILING 3 | 13 | #define SLEEP_PROFILING 3 |
@@ -19,14 +17,29 @@ struct proc_dir_entry; | |||
19 | struct pt_regs; | 17 | struct pt_regs; |
20 | struct notifier_block; | 18 | struct notifier_block; |
21 | 19 | ||
20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) | ||
21 | void create_prof_cpu_mask(struct proc_dir_entry *); | ||
22 | #else | ||
23 | #define create_prof_cpu_mask(x) do { (void)(x); } while (0) | ||
24 | #endif | ||
25 | |||
26 | enum profile_type { | ||
27 | PROFILE_TASK_EXIT, | ||
28 | PROFILE_MUNMAP | ||
29 | }; | ||
30 | |||
31 | #ifdef CONFIG_PROFILING | ||
32 | |||
33 | extern int prof_on __read_mostly; | ||
34 | |||
22 | /* init basic kernel profiler */ | 35 | /* init basic kernel profiler */ |
23 | void __init profile_init(void); | 36 | void __init profile_init(void); |
24 | void profile_tick(int); | 37 | void profile_tick(int type); |
25 | 38 | ||
26 | /* | 39 | /* |
27 | * Add multiple profiler hits to a given address: | 40 | * Add multiple profiler hits to a given address: |
28 | */ | 41 | */ |
29 | void profile_hits(int, void *ip, unsigned int nr_hits); | 42 | void profile_hits(int type, void *ip, unsigned int nr_hits); |
30 | 43 | ||
31 | /* | 44 | /* |
32 | * Single profiler hit: | 45 | * Single profiler hit: |
@@ -40,19 +53,6 @@ static inline void profile_hit(int type, void *ip) | |||
40 | profile_hits(type, ip, 1); | 53 | profile_hits(type, ip, 1); |
41 | } | 54 | } |
42 | 55 | ||
43 | #ifdef CONFIG_PROC_FS | ||
44 | void create_prof_cpu_mask(struct proc_dir_entry *); | ||
45 | #else | ||
46 | #define create_prof_cpu_mask(x) do { (void)(x); } while (0) | ||
47 | #endif | ||
48 | |||
49 | enum profile_type { | ||
50 | PROFILE_TASK_EXIT, | ||
51 | PROFILE_MUNMAP | ||
52 | }; | ||
53 | |||
54 | #ifdef CONFIG_PROFILING | ||
55 | |||
56 | struct task_struct; | 56 | struct task_struct; |
57 | struct mm_struct; | 57 | struct mm_struct; |
58 | 58 | ||
@@ -80,6 +80,28 @@ struct pt_regs; | |||
80 | 80 | ||
81 | #else | 81 | #else |
82 | 82 | ||
83 | #define prof_on 0 | ||
84 | |||
85 | static inline void profile_init(void) | ||
86 | { | ||
87 | return; | ||
88 | } | ||
89 | |||
90 | static inline void profile_tick(int type) | ||
91 | { | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | static inline void profile_hits(int type, void *ip, unsigned int nr_hits) | ||
96 | { | ||
97 | return; | ||
98 | } | ||
99 | |||
100 | static inline void profile_hit(int type, void *ip) | ||
101 | { | ||
102 | return; | ||
103 | } | ||
104 | |||
83 | static inline int task_handoff_register(struct notifier_block * n) | 105 | static inline int task_handoff_register(struct notifier_block * n) |
84 | { | 106 | { |
85 | return -ENOSYS; | 107 | return -ENOSYS; |