ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / profile.h
1 #ifndef _LINUX_PROFILE_H
2 #define _LINUX_PROFILE_H
3
4 #ifdef __KERNEL__
5
6 #include <linux/kernel.h>
7 #include <linux/config.h>
8 #include <linux/init.h>
9 #include <asm/errno.h>
10
11 /* parse command line */
12 int __init profile_setup(char * str);
13
14 /* init basic kernel profiler */
15 void __init profile_init(void);
16
17 extern unsigned int * prof_buffer;
18 extern unsigned long prof_len;
19 extern unsigned long prof_shift;
20 extern int prof_on;
21
22
23 enum profile_type {
24         EXIT_TASK,
25         EXIT_MMAP,
26         EXEC_UNMAP
27 };
28
29 #ifdef CONFIG_PROFILING
30
31 struct notifier_block;
32 struct task_struct;
33 struct mm_struct;
34
35 /* task is in do_exit() */
36 void profile_exit_task(struct task_struct * task);
37
38 /* change of vma mappings */
39 void profile_exec_unmap(struct mm_struct * mm);
40
41 /* exit of all vmas for a task */
42 void profile_exit_mmap(struct mm_struct * mm);
43
44 int profile_event_register(enum profile_type, struct notifier_block * n);
45
46 int profile_event_unregister(enum profile_type, struct notifier_block * n);
47
48 int register_profile_notifier(struct notifier_block * nb);
49 int unregister_profile_notifier(struct notifier_block * nb);
50
51 struct pt_regs;
52
53 /* profiling hook activated on each timer interrupt */
54 void profile_hook(struct pt_regs * regs);
55
56 #else
57
58 static inline int profile_event_register(enum profile_type t, struct notifier_block * n)
59 {
60         return -ENOSYS;
61 }
62
63 static inline int profile_event_unregister(enum profile_type t, struct notifier_block * n)
64 {
65         return -ENOSYS;
66 }
67
68 #define profile_exit_task(a) do { } while (0)
69 #define profile_exec_unmap(a) do { } while (0)
70 #define profile_exit_mmap(a) do { } while (0)
71
72 static inline int register_profile_notifier(struct notifier_block * nb)
73 {
74         return -ENOSYS;
75 }
76
77 static inline int unregister_profile_notifier(struct notifier_block * nb)
78 {
79         return -ENOSYS;
80 }
81
82 #define profile_hook(regs) do { } while (0)
83
84 #endif /* CONFIG_PROFILING */
85
86 #endif /* __KERNEL__ */
87
88 #endif /* _LINUX_PROFILE_H */