0001
0002 #ifndef _LINUX_SCHED_CLOCK_H
0003 #define _LINUX_SCHED_CLOCK_H
0004
0005 #include <linux/smp.h>
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 extern unsigned long long notrace sched_clock(void);
0016
0017
0018
0019
0020 extern u64 running_clock(void);
0021 extern u64 sched_clock_cpu(int cpu);
0022
0023
0024 extern void sched_clock_init(void);
0025
0026 #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
0027 static inline void sched_clock_tick(void)
0028 {
0029 }
0030
0031 static inline void clear_sched_clock_stable(void)
0032 {
0033 }
0034
0035 static inline void sched_clock_idle_sleep_event(void)
0036 {
0037 }
0038
0039 static inline void sched_clock_idle_wakeup_event(void)
0040 {
0041 }
0042
0043 static inline u64 cpu_clock(int cpu)
0044 {
0045 return sched_clock();
0046 }
0047
0048 static inline u64 local_clock(void)
0049 {
0050 return sched_clock();
0051 }
0052 #else
0053 extern int sched_clock_stable(void);
0054 extern void clear_sched_clock_stable(void);
0055
0056
0057
0058
0059
0060 extern u64 __sched_clock_offset;
0061
0062 extern void sched_clock_tick(void);
0063 extern void sched_clock_tick_stable(void);
0064 extern void sched_clock_idle_sleep_event(void);
0065 extern void sched_clock_idle_wakeup_event(void);
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 static inline u64 cpu_clock(int cpu)
0078 {
0079 return sched_clock_cpu(cpu);
0080 }
0081
0082 static inline u64 local_clock(void)
0083 {
0084 return sched_clock_cpu(raw_smp_processor_id());
0085 }
0086 #endif
0087
0088 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
0089
0090
0091
0092
0093
0094 extern void enable_sched_clock_irqtime(void);
0095 extern void disable_sched_clock_irqtime(void);
0096 #else
0097 static inline void enable_sched_clock_irqtime(void) {}
0098 static inline void disable_sched_clock_irqtime(void) {}
0099 #endif
0100
0101 #endif