Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_PROFILE_H
0003 #define _LINUX_PROFILE_H
0004 
0005 #include <linux/kernel.h>
0006 #include <linux/init.h>
0007 #include <linux/cpumask.h>
0008 #include <linux/cache.h>
0009 
0010 #include <asm/errno.h>
0011 
0012 #define CPU_PROFILING   1
0013 #define SCHED_PROFILING 2
0014 #define SLEEP_PROFILING 3
0015 #define KVM_PROFILING   4
0016 
0017 struct proc_dir_entry;
0018 struct notifier_block;
0019 
0020 #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS)
0021 void create_prof_cpu_mask(void);
0022 int create_proc_profile(void);
0023 #else
0024 static inline void create_prof_cpu_mask(void)
0025 {
0026 }
0027 
0028 static inline int create_proc_profile(void)
0029 {
0030     return 0;
0031 }
0032 #endif
0033 
0034 #ifdef CONFIG_PROFILING
0035 
0036 extern int prof_on __read_mostly;
0037 
0038 /* init basic kernel profiler */
0039 int profile_init(void);
0040 int profile_setup(char *str);
0041 void profile_tick(int type);
0042 int setup_profiling_timer(unsigned int multiplier);
0043 
0044 /*
0045  * Add multiple profiler hits to a given address:
0046  */
0047 void profile_hits(int type, void *ip, unsigned int nr_hits);
0048 
0049 /*
0050  * Single profiler hit:
0051  */
0052 static inline void profile_hit(int type, void *ip)
0053 {
0054     /*
0055      * Speedup for the common (no profiling enabled) case:
0056      */
0057     if (unlikely(prof_on == type))
0058         profile_hits(type, ip, 1);
0059 }
0060 
0061 struct task_struct;
0062 struct mm_struct;
0063 
0064 #else
0065 
0066 #define prof_on 0
0067 
0068 static inline int profile_init(void)
0069 {
0070     return 0;
0071 }
0072 
0073 static inline void profile_tick(int type)
0074 {
0075     return;
0076 }
0077 
0078 static inline void profile_hits(int type, void *ip, unsigned int nr_hits)
0079 {
0080     return;
0081 }
0082 
0083 static inline void profile_hit(int type, void *ip)
0084 {
0085     return;
0086 }
0087 
0088 
0089 #endif /* CONFIG_PROFILING */
0090 
0091 #endif /* _LINUX_PROFILE_H */