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 KVM_PROFILING 4
15 struct proc_dir_entry
;
16 struct notifier_block
;
18 #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS)
19 int create_proc_profile(void);
21 static inline int create_proc_profile(void)
27 #ifdef CONFIG_PROFILING
29 extern int prof_on __read_mostly
;
31 /* init basic kernel profiler */
32 int profile_init(void);
33 int profile_setup(char *str
);
34 void profile_tick(int type
);
35 int setup_profiling_timer(unsigned int multiplier
);
38 * Add multiple profiler hits to a given address:
40 void profile_hits(int type
, void *ip
, unsigned int nr_hits
);
43 * Single profiler hit:
45 static inline void profile_hit(int type
, void *ip
)
48 * Speedup for the common (no profiling enabled) case:
50 if (unlikely(prof_on
== type
))
51 profile_hits(type
, ip
, 1);
61 static inline int profile_init(void)
66 static inline void profile_tick(int type
)
71 static inline void profile_hits(int type
, void *ip
, unsigned int nr_hits
)
76 static inline void profile_hit(int type
, void *ip
)
82 #endif /* CONFIG_PROFILING */
84 #endif /* _LINUX_PROFILE_H */