~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/sched/clock.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_SCHED_CLOCK_H
  3 #define _LINUX_SCHED_CLOCK_H
  4 
  5 #include <linux/smp.h>
  6 
  7 /*
  8  * Do not use outside of architecture code which knows its limitations.
  9  *
 10  * sched_clock() has no promise of monotonicity or bounded drift between
 11  * CPUs, use (which you should not) requires disabling IRQs.
 12  *
 13  * Please use one of the three interfaces below.
 14  */
 15 extern u64 sched_clock(void);
 16 
 17 #if defined(CONFIG_ARCH_WANTS_NO_INSTR) || defined(CONFIG_GENERIC_SCHED_CLOCK)
 18 extern u64 sched_clock_noinstr(void);
 19 #else
 20 static __always_inline u64 sched_clock_noinstr(void)
 21 {
 22         return sched_clock();
 23 }
 24 #endif
 25 
 26 /*
 27  * See the comment in kernel/sched/clock.c
 28  */
 29 extern u64 running_clock(void);
 30 extern u64 sched_clock_cpu(int cpu);
 31 
 32 
 33 extern void sched_clock_init(void);
 34 
 35 #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
 36 static inline void sched_clock_tick(void)
 37 {
 38 }
 39 
 40 static inline void clear_sched_clock_stable(void)
 41 {
 42 }
 43 
 44 static inline void sched_clock_idle_sleep_event(void)
 45 {
 46 }
 47 
 48 static inline void sched_clock_idle_wakeup_event(void)
 49 {
 50 }
 51 
 52 static inline u64 cpu_clock(int cpu)
 53 {
 54         return sched_clock();
 55 }
 56 
 57 static __always_inline u64 local_clock_noinstr(void)
 58 {
 59         return sched_clock_noinstr();
 60 }
 61 
 62 static __always_inline u64 local_clock(void)
 63 {
 64         return sched_clock();
 65 }
 66 #else
 67 extern int sched_clock_stable(void);
 68 extern void clear_sched_clock_stable(void);
 69 
 70 /*
 71  * When sched_clock_stable(), __sched_clock_offset provides the offset
 72  * between local_clock() and sched_clock().
 73  */
 74 extern u64 __sched_clock_offset;
 75 
 76 extern void sched_clock_tick(void);
 77 extern void sched_clock_tick_stable(void);
 78 extern void sched_clock_idle_sleep_event(void);
 79 extern void sched_clock_idle_wakeup_event(void);
 80 
 81 /*
 82  * As outlined in clock.c, provides a fast, high resolution, nanosecond
 83  * time source that is monotonic per cpu argument and has bounded drift
 84  * between cpus.
 85  *
 86  * ######################### BIG FAT WARNING ##########################
 87  * # when comparing cpu_clock(i) to cpu_clock(j) for i != j, time can #
 88  * # go backwards !!                                                  #
 89  * ####################################################################
 90  */
 91 static inline u64 cpu_clock(int cpu)
 92 {
 93         return sched_clock_cpu(cpu);
 94 }
 95 
 96 extern u64 local_clock_noinstr(void);
 97 extern u64 local_clock(void);
 98 
 99 #endif
100 
101 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
102 /*
103  * An i/f to runtime opt-in for irq time accounting based off of sched_clock.
104  * The reason for this explicit opt-in is not to have perf penalty with
105  * slow sched_clocks.
106  */
107 extern void enable_sched_clock_irqtime(void);
108 extern void disable_sched_clock_irqtime(void);
109 #else
110 static inline void enable_sched_clock_irqtime(void) {}
111 static inline void disable_sched_clock_irqtime(void) {}
112 #endif
113 
114 #endif /* _LINUX_SCHED_CLOCK_H */
115 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php