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 int create_proc_profile(void);
23 static inline int create_proc_profile(void)
29 #ifdef CONFIG_PROFILING
31 extern int prof_on __read_mostly;
33 /* init basic kernel profiler */
34 int profile_init(void);
35 int profile_setup(char *str);
36 void profile_tick(int type);
37 int setup_profiling_timer(unsigned int multiplier);
40 * Add multiple profiler hits to a given address:
42 void profile_hits(int type, void *ip, unsigned int nr_hits);
45 * Single profiler hit:
47 static inline void profile_hit(int type, void *ip)
50 * Speedup for the common (no profiling enabled) case:
52 if (unlikely(prof_on == type))
53 profile_hits(type, ip, 1);
63 static inline int profile_init(void)
68 static inline void profile_tick(int type)
73 static inline void profile_hits(int type, void *ip, unsigned int nr_hits)
78 static inline void profile_hit(int type, void *ip)
84 #endif /* CONFIG_PROFILING */
86 #endif /* _LINUX_PROFILE_H */