Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / include / linux / profile.h
blob3f53cdb0c27c1a2be13d63199f2949a2033f174c
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>
9 #include <asm/errno.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);
20 #else
21 static inline int create_proc_profile(void)
23 return 0;
25 #endif
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);
54 struct task_struct;
55 struct mm_struct;
57 #else
59 #define prof_on 0
61 static inline int profile_init(void)
63 return 0;
66 static inline void profile_tick(int type)
68 return;
71 static inline void profile_hits(int type, void *ip, unsigned int nr_hits)
73 return;
76 static inline void profile_hit(int type, void *ip)
78 return;
82 #endif /* CONFIG_PROFILING */
84 #endif /* _LINUX_PROFILE_H */