MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / linux / profile.h
bloba22f4a15c9811f74d080e12006419735d15488d2
1 #ifndef _LINUX_PROFILE_H
2 #define _LINUX_PROFILE_H
4 #ifdef __KERNEL__
6 #include <linux/kernel.h>
7 #include <linux/config.h>
8 #include <linux/init.h>
9 #include <linux/cpumask.h>
10 #include <asm/errno.h>
12 #define CPU_PROFILING 1
13 #define SCHED_PROFILING 2
15 struct proc_dir_entry;
16 struct pt_regs;
18 /* init basic kernel profiler */
19 void __init profile_init(void);
20 void profile_tick(int, struct pt_regs *);
21 void profile_hit(int, void *);
22 #ifdef CONFIG_PROC_FS
23 void create_prof_cpu_mask(struct proc_dir_entry *);
24 #else
25 #define create_prof_cpu_mask(x) do { (void)(x); } while (0)
26 #endif
28 enum profile_type {
29 PROFILE_TASK_EXIT,
30 PROFILE_MUNMAP
33 #ifdef CONFIG_PROFILING
35 struct notifier_block;
36 struct task_struct;
37 struct mm_struct;
39 /* task is in do_exit() */
40 void profile_task_exit(struct task_struct * task);
42 /* task is dead, free task struct ? Returns 1 if
43 * the task was taken, 0 if the task should be freed.
45 int profile_handoff_task(struct task_struct * task);
47 /* sys_munmap */
48 void profile_munmap(unsigned long addr);
50 int task_handoff_register(struct notifier_block * n);
51 int task_handoff_unregister(struct notifier_block * n);
53 int profile_event_register(enum profile_type, struct notifier_block * n);
54 int profile_event_unregister(enum profile_type, struct notifier_block * n);
56 int register_profile_notifier(struct notifier_block * nb);
57 int unregister_profile_notifier(struct notifier_block * nb);
59 struct pt_regs;
61 /* profiling hook activated on each timer interrupt */
62 void profile_hook(struct pt_regs * regs);
64 #else
66 static inline int task_handoff_register(struct notifier_block * n)
68 return -ENOSYS;
71 static inline int task_handoff_unregister(struct notifier_block * n)
73 return -ENOSYS;
76 static inline int profile_event_register(enum profile_type t, struct notifier_block * n)
78 return -ENOSYS;
81 static inline int profile_event_unregister(enum profile_type t, struct notifier_block * n)
83 return -ENOSYS;
86 #define profile_task_exit(a) do { } while (0)
87 #define profile_handoff_task(a) (0)
88 #define profile_munmap(a) do { } while (0)
90 static inline int register_profile_notifier(struct notifier_block * nb)
92 return -ENOSYS;
95 static inline int unregister_profile_notifier(struct notifier_block * nb)
97 return -ENOSYS;
100 #define profile_hook(regs) do { } while (0)
102 #endif /* CONFIG_PROFILING */
104 #endif /* __KERNEL__ */
106 #endif /* _LINUX_PROFILE_H */