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/cache.h>
11 #define CPU_PROFILING 1
12 #define SCHED_PROFILING 2
13 #define SLEEP_PROFILING 3
14 #define KVM_PROFILING 4
16 struct proc_dir_entry;
17 struct notifier_block;
19 #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS)
20 int create_proc_profile(void);
22 static inline int create_proc_profile(void)
28 #ifdef CONFIG_PROFILING
30 extern int prof_on __read_mostly;
32 /* init basic kernel profiler */
33 int profile_init(void);
34 int profile_setup(char *str);
35 void profile_tick(int type);
36 int setup_profiling_timer(unsigned int multiplier);
39 * Add multiple profiler hits to a given address:
41 void profile_hits(int type, void *ip, unsigned int nr_hits);
44 * Single profiler hit:
46 static inline void profile_hit(int type, void *ip)
49 * Speedup for the common (no profiling enabled) case:
51 if (unlikely(prof_on == type))
52 profile_hits(type, ip, 1);
62 static inline int profile_init(void)
67 static inline void profile_tick(int type)
72 static inline void profile_hits(int type, void *ip, unsigned int nr_hits)
77 static inline void profile_hit(int type, void *ip)
83 #endif /* CONFIG_PROFILING */
85 #endif /* _LINUX_PROFILE_H */