Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | #ifndef _LINUX_PROFILE_H |
3 | #define _LINUX_PROFILE_H | |
4 | ||
1da177e4 | 5 | #include <linux/kernel.h> |
1da177e4 LT |
6 | #include <linux/init.h> |
7 | #include <linux/cpumask.h> | |
ece8a684 IM |
8 | #include <linux/cache.h> |
9 | ||
1da177e4 LT |
10 | #include <asm/errno.h> |
11 | ||
12 | #define CPU_PROFILING 1 | |
13 | #define SCHED_PROFILING 2 | |
ece8a684 | 14 | #define SLEEP_PROFILING 3 |
07031e14 | 15 | #define KVM_PROFILING 4 |
1da177e4 LT |
16 | |
17 | struct proc_dir_entry; | |
772a0dc5 | 18 | struct notifier_block; |
1da177e4 | 19 | |
b03f6489 | 20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) |
fbd387ae | 21 | void create_prof_cpu_mask(void); |
66f50ee3 | 22 | int create_proc_profile(void); |
b03f6489 | 23 | #else |
fbd387ae | 24 | static inline void create_prof_cpu_mask(void) |
cebbd3fb AM |
25 | { |
26 | } | |
66f50ee3 PM |
27 | |
28 | static inline int create_proc_profile(void) | |
29 | { | |
30 | return 0; | |
31 | } | |
b03f6489 AB |
32 | #endif |
33 | ||
b03f6489 AB |
34 | #ifdef CONFIG_PROFILING |
35 | ||
36 | extern int prof_on __read_mostly; | |
37 | ||
1da177e4 | 38 | /* init basic kernel profiler */ |
22b8ce94 DH |
39 | int profile_init(void); |
40 | int profile_setup(char *str); | |
b03f6489 | 41 | void profile_tick(int type); |
d3091298 | 42 | int setup_profiling_timer(unsigned int multiplier); |
ece8a684 IM |
43 | |
44 | /* | |
45 | * Add multiple profiler hits to a given address: | |
46 | */ | |
b03f6489 | 47 | void profile_hits(int type, void *ip, unsigned int nr_hits); |
ece8a684 IM |
48 | |
49 | /* | |
50 | * Single profiler hit: | |
51 | */ | |
52 | static inline void profile_hit(int type, void *ip) | |
53 | { | |
54 | /* | |
55 | * Speedup for the common (no profiling enabled) case: | |
56 | */ | |
57 | if (unlikely(prof_on == type)) | |
58 | profile_hits(type, ip, 1); | |
59 | } | |
60 | ||
1da177e4 LT |
61 | struct task_struct; |
62 | struct mm_struct; | |
63 | ||
1da177e4 LT |
64 | #else |
65 | ||
b03f6489 AB |
66 | #define prof_on 0 |
67 | ||
22b8ce94 | 68 | static inline int profile_init(void) |
b03f6489 | 69 | { |
22b8ce94 | 70 | return 0; |
b03f6489 AB |
71 | } |
72 | ||
73 | static inline void profile_tick(int type) | |
74 | { | |
75 | return; | |
76 | } | |
77 | ||
78 | static inline void profile_hits(int type, void *ip, unsigned int nr_hits) | |
79 | { | |
80 | return; | |
81 | } | |
82 | ||
83 | static inline void profile_hit(int type, void *ip) | |
84 | { | |
85 | return; | |
86 | } | |
87 | ||
1da177e4 | 88 | |
1da177e4 LT |
89 | #endif /* CONFIG_PROFILING */ |
90 | ||
1da177e4 | 91 | #endif /* _LINUX_PROFILE_H */ |