1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_PROFILE_H
3 #define _LINUX_PROFILE_H
5 #include <linux/kernel.h>
6 #include <linux/init.h>
7 #include <linux/cpumask.h>
8 #include <linux/cache.h>
10 #include <asm/errno.h>
12 #define CPU_PROFILING 1
13 #define SCHED_PROFILING 2
14 #define SLEEP_PROFILING 3
15 #define KVM_PROFILING 4
17 struct proc_dir_entry;
18 struct notifier_block;
20 #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS)
21 void create_prof_cpu_mask(void);
22 int create_proc_profile(void);
24 static inline void create_prof_cpu_mask(void)
28 static inline int create_proc_profile(void)
34 #ifdef CONFIG_PROFILING
36 extern int prof_on __read_mostly;
38 /* init basic kernel profiler */
39 int profile_init(void);
40 int profile_setup(char *str);
41 void profile_tick(int type);
42 int setup_profiling_timer(unsigned int multiplier);
45 * Add multiple profiler hits to a given address:
47 void profile_hits(int type, void *ip, unsigned int nr_hits);
50 * Single profiler hit:
52 static inline void profile_hit(int type, void *ip)
55 * Speedup for the common (no profiling enabled) case:
57 if (unlikely(prof_on == type))
58 profile_hits(type, ip, 1);
68 static inline int profile_init(void)
73 static inline void profile_tick(int type)
78 static inline void profile_hits(int type, void *ip, unsigned int nr_hits)
83 static inline void profile_hit(int type, void *ip)
89 #endif /* CONFIG_PROFILING */
91 #endif /* _LINUX_PROFILE_H */