1 #ifndef _LINUX_PROFILE_H
2 #define _LINUX_PROFILE_H
6 #include <linux/kernel.h>
7 #include <linux/init.h>
8 #include <linux/cpumask.h>
11 #define CPU_PROFILING 1
12 #define SCHED_PROFILING 2
14 struct proc_dir_entry
;
16 struct notifier_block
;
18 /* init basic kernel profiler */
19 void __init
profile_init(void);
20 void profile_tick(int);
21 void profile_hit(int, void *);
23 void create_prof_cpu_mask(struct proc_dir_entry
*);
25 #define create_prof_cpu_mask(x) do { (void)(x); } while (0)
33 #ifdef CONFIG_PROFILING
38 /* task is in do_exit() */
39 void profile_task_exit(struct task_struct
* task
);
41 /* task is dead, free task struct ? Returns 1 if
42 * the task was taken, 0 if the task should be freed.
44 int profile_handoff_task(struct task_struct
* task
);
47 void profile_munmap(unsigned long addr
);
49 int task_handoff_register(struct notifier_block
* n
);
50 int task_handoff_unregister(struct notifier_block
* n
);
52 int profile_event_register(enum profile_type
, struct notifier_block
* n
);
53 int profile_event_unregister(enum profile_type
, struct notifier_block
* n
);
55 int register_timer_hook(int (*hook
)(struct pt_regs
*));
56 void unregister_timer_hook(int (*hook
)(struct pt_regs
*));
58 /* Timer based profiling hook */
59 extern int (*timer_hook
)(struct pt_regs
*);
65 static inline int task_handoff_register(struct notifier_block
* n
)
70 static inline int task_handoff_unregister(struct notifier_block
* n
)
75 static inline int profile_event_register(enum profile_type t
, struct notifier_block
* n
)
80 static inline int profile_event_unregister(enum profile_type t
, struct notifier_block
* n
)
85 #define profile_task_exit(a) do { } while (0)
86 #define profile_handoff_task(a) (0)
87 #define profile_munmap(a) do { } while (0)
89 static inline int register_timer_hook(int (*hook
)(struct pt_regs
*))
94 static inline void unregister_timer_hook(int (*hook
)(struct pt_regs
*))
99 #endif /* CONFIG_PROFILING */
101 #endif /* __KERNEL__ */
103 #endif /* _LINUX_PROFILE_H */