aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/profile.h56
-rw-r--r--kernel/Makefile3
-rw-r--r--kernel/profile.c4
3 files changed, 41 insertions, 22 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
11extern 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;
19struct pt_regs; 17struct pt_regs;
20struct notifier_block; 18struct notifier_block;
21 19
20#if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS)
21void 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
26enum profile_type {
27 PROFILE_TASK_EXIT,
28 PROFILE_MUNMAP
29};
30
31#ifdef CONFIG_PROFILING
32
33extern int prof_on __read_mostly;
34
22/* init basic kernel profiler */ 35/* init basic kernel profiler */
23void __init profile_init(void); 36void __init profile_init(void);
24void profile_tick(int); 37void 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 */
29void profile_hits(int, void *ip, unsigned int nr_hits); 42void 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
44void 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
49enum profile_type {
50 PROFILE_TASK_EXIT,
51 PROFILE_MUNMAP
52};
53
54#ifdef CONFIG_PROFILING
55
56struct task_struct; 56struct task_struct;
57struct mm_struct; 57struct 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
85static inline void profile_init(void)
86{
87 return;
88}
89
90static inline void profile_tick(int type)
91{
92 return;
93}
94
95static inline void profile_hits(int type, void *ip, unsigned int nr_hits)
96{
97 return;
98}
99
100static inline void profile_hit(int type, void *ip)
101{
102 return;
103}
104
83static inline int task_handoff_register(struct notifier_block * n) 105static inline int task_handoff_register(struct notifier_block * n)
84{ 106{
85 return -ENOSYS; 107 return -ENOSYS;
diff --git a/kernel/Makefile b/kernel/Makefile
index 15ab63ffe64d..54f69837d35a 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \ 5obj-y = sched.o fork.o exec_domain.o panic.o printk.o \
6 cpu.o exit.o itimer.o time.o softirq.o resource.o \ 6 cpu.o exit.o itimer.o time.o softirq.o resource.o \
7 sysctl.o capability.o ptrace.o timer.o user.o \ 7 sysctl.o capability.o ptrace.o timer.o user.o \
8 signal.o sys.o kmod.o workqueue.o pid.o \ 8 signal.o sys.o kmod.o workqueue.o pid.o \
@@ -24,6 +24,7 @@ CFLAGS_REMOVE_sched_clock.o = -pg
24CFLAGS_REMOVE_sched.o = -mno-spe -pg 24CFLAGS_REMOVE_sched.o = -mno-spe -pg
25endif 25endif
26 26
27obj-$(CONFIG_PROFILING) += profile.o
27obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o 28obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
28obj-$(CONFIG_STACKTRACE) += stacktrace.o 29obj-$(CONFIG_STACKTRACE) += stacktrace.o
29obj-y += time/ 30obj-y += time/
diff --git a/kernel/profile.c b/kernel/profile.c
index 58926411eb2a..cd26bed4cc26 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -112,8 +112,6 @@ void __init profile_init(void)
112 112
113/* Profile event notifications */ 113/* Profile event notifications */
114 114
115#ifdef CONFIG_PROFILING
116
117static BLOCKING_NOTIFIER_HEAD(task_exit_notifier); 115static BLOCKING_NOTIFIER_HEAD(task_exit_notifier);
118static ATOMIC_NOTIFIER_HEAD(task_free_notifier); 116static ATOMIC_NOTIFIER_HEAD(task_free_notifier);
119static BLOCKING_NOTIFIER_HEAD(munmap_notifier); 117static BLOCKING_NOTIFIER_HEAD(munmap_notifier);
@@ -203,8 +201,6 @@ void unregister_timer_hook(int (*hook)(struct pt_regs *))
203} 201}
204EXPORT_SYMBOL_GPL(unregister_timer_hook); 202EXPORT_SYMBOL_GPL(unregister_timer_hook);
205 203
206#endif /* CONFIG_PROFILING */
207
208 204
209#ifdef CONFIG_SMP 205#ifdef CONFIG_SMP
210/* 206/*