Blame view
include/linux/profile.h
2.92 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 |
#ifndef _LINUX_PROFILE_H #define _LINUX_PROFILE_H |
1da177e4c Linux-2.6.12-rc2 |
3 |
#include <linux/kernel.h> |
1da177e4c Linux-2.6.12-rc2 |
4 5 |
#include <linux/init.h> #include <linux/cpumask.h> |
ece8a684c [PATCH] sleep pro... |
6 |
#include <linux/cache.h> |
1da177e4c Linux-2.6.12-rc2 |
7 8 9 10 |
#include <asm/errno.h> #define CPU_PROFILING 1 #define SCHED_PROFILING 2 |
ece8a684c [PATCH] sleep pro... |
11 |
#define SLEEP_PROFILING 3 |
07031e14c [PATCH] KVM: add ... |
12 |
#define KVM_PROFILING 4 |
1da177e4c Linux-2.6.12-rc2 |
13 14 15 |
struct proc_dir_entry; struct pt_regs; |
772a0dc5d [PATCH] notifier:... |
16 |
struct notifier_block; |
1da177e4c Linux-2.6.12-rc2 |
17 |
|
b03f6489f build kernel/prof... |
18 |
#if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) |
cebbd3fb8 build-kernel-prof... |
19 |
void create_prof_cpu_mask(struct proc_dir_entry *de); |
66f50ee3c profiling: fix up... |
20 |
int create_proc_profile(void); |
b03f6489f build kernel/prof... |
21 |
#else |
cebbd3fb8 build-kernel-prof... |
22 23 24 |
static inline void create_prof_cpu_mask(struct proc_dir_entry *de) { } |
66f50ee3c profiling: fix up... |
25 26 27 28 29 |
static inline int create_proc_profile(void) { return 0; } |
b03f6489f build kernel/prof... |
30 31 32 33 34 35 36 37 38 39 |
#endif enum profile_type { PROFILE_TASK_EXIT, PROFILE_MUNMAP }; #ifdef CONFIG_PROFILING extern int prof_on __read_mostly; |
1da177e4c Linux-2.6.12-rc2 |
40 |
/* init basic kernel profiler */ |
22b8ce947 profiling: dynami... |
41 42 |
int profile_init(void); int profile_setup(char *str); |
b03f6489f build kernel/prof... |
43 |
void profile_tick(int type); |
ece8a684c [PATCH] sleep pro... |
44 45 46 47 |
/* * Add multiple profiler hits to a given address: */ |
b03f6489f build kernel/prof... |
48 |
void profile_hits(int type, void *ip, unsigned int nr_hits); |
ece8a684c [PATCH] sleep pro... |
49 50 51 52 53 54 55 56 57 58 59 60 |
/* * Single profiler hit: */ static inline void profile_hit(int type, void *ip) { /* * Speedup for the common (no profiling enabled) case: */ if (unlikely(prof_on == type)) profile_hits(type, ip, 1); } |
1da177e4c Linux-2.6.12-rc2 |
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
struct task_struct; struct mm_struct; /* task is in do_exit() */ void profile_task_exit(struct task_struct * task); /* task is dead, free task struct ? Returns 1 if * the task was taken, 0 if the task should be freed. */ int profile_handoff_task(struct task_struct * task); /* sys_munmap */ void profile_munmap(unsigned long addr); int task_handoff_register(struct notifier_block * n); int task_handoff_unregister(struct notifier_block * n); int profile_event_register(enum profile_type, struct notifier_block * n); int profile_event_unregister(enum profile_type, struct notifier_block * n); int register_timer_hook(int (*hook)(struct pt_regs *)); void unregister_timer_hook(int (*hook)(struct pt_regs *)); |
1da177e4c Linux-2.6.12-rc2 |
83 84 85 |
struct pt_regs; #else |
b03f6489f build kernel/prof... |
86 |
#define prof_on 0 |
22b8ce947 profiling: dynami... |
87 |
static inline int profile_init(void) |
b03f6489f build kernel/prof... |
88 |
{ |
22b8ce947 profiling: dynami... |
89 |
return 0; |
b03f6489f build kernel/prof... |
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
} static inline void profile_tick(int type) { return; } static inline void profile_hits(int type, void *ip, unsigned int nr_hits) { return; } static inline void profile_hit(int type, void *ip) { return; } |
1da177e4c Linux-2.6.12-rc2 |
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
static inline int task_handoff_register(struct notifier_block * n) { return -ENOSYS; } static inline int task_handoff_unregister(struct notifier_block * n) { return -ENOSYS; } static inline int profile_event_register(enum profile_type t, struct notifier_block * n) { return -ENOSYS; } static inline int profile_event_unregister(enum profile_type t, struct notifier_block * n) { return -ENOSYS; } #define profile_task_exit(a) do { } while (0) #define profile_handoff_task(a) (0) #define profile_munmap(a) do { } while (0) static inline int register_timer_hook(int (*hook)(struct pt_regs *)) { return -ENOSYS; } static inline void unregister_timer_hook(int (*hook)(struct pt_regs *)) { return; } #endif /* CONFIG_PROFILING */ |
1da177e4c Linux-2.6.12-rc2 |
141 |
#endif /* _LINUX_PROFILE_H */ |