]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/sched/clock.h
1 #ifndef _LINUX_SCHED_CLOCK_H
2 #define _LINUX_SCHED_CLOCK_H
7 * Do not use outside of architecture code which knows its limitations.
9 * sched_clock() has no promise of monotonicity or bounded drift between
10 * CPUs, use (which you should not) requires disabling IRQs.
12 * Please use one of the three interfaces below.
14 extern unsigned long long notrace
sched_clock(void);
17 * See the comment in kernel/sched/clock.c
19 extern u64
running_clock(void);
20 extern u64
sched_clock_cpu(int cpu
);
23 extern void sched_clock_init(void);
25 #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
26 static inline void sched_clock_init_late(void)
30 static inline void sched_clock_tick(void)
34 static inline void clear_sched_clock_stable(void)
38 static inline void sched_clock_idle_sleep_event(void)
42 static inline void sched_clock_idle_wakeup_event(u64 delta_ns
)
46 static inline u64
cpu_clock(int cpu
)
51 static inline u64
local_clock(void)
56 extern void sched_clock_init_late(void);
57 extern int sched_clock_stable(void);
58 extern void clear_sched_clock_stable(void);
61 * When sched_clock_stable(), __sched_clock_offset provides the offset
62 * between local_clock() and sched_clock().
64 extern u64 __sched_clock_offset
;
67 extern void sched_clock_tick(void);
68 extern void sched_clock_idle_sleep_event(void);
69 extern void sched_clock_idle_wakeup_event(u64 delta_ns
);
72 * As outlined in clock.c, provides a fast, high resolution, nanosecond
73 * time source that is monotonic per cpu argument and has bounded drift
76 * ######################### BIG FAT WARNING ##########################
77 * # when comparing cpu_clock(i) to cpu_clock(j) for i != j, time can #
79 * ####################################################################
81 static inline u64
cpu_clock(int cpu
)
83 return sched_clock_cpu(cpu
);
86 static inline u64
local_clock(void)
88 return sched_clock_cpu(raw_smp_processor_id());
92 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
94 * An i/f to runtime opt-in for irq time accounting based off of sched_clock.
95 * The reason for this explicit opt-in is not to have perf penalty with
98 extern void enable_sched_clock_irqtime(void);
99 extern void disable_sched_clock_irqtime(void);
101 static inline void enable_sched_clock_irqtime(void) {}
102 static inline void disable_sched_clock_irqtime(void) {}
105 #endif /* _LINUX_SCHED_CLOCK_H */