Lines Matching +full:in +full:- +full:and +full:- +full:around

2 Clock sources, Clock events, sched_clock() and delay timers
6 abstractions. It partly pertains to the drivers usually found in
7 drivers/clocksource in the kernel tree, but the code may be spread out
10 If you grep through the kernel source you will find a number of architecture-
11 specific implementations of clock sources, clockevents and several likewise
12 architecture-specific overrides of the sched_clock() function and some
17 on this timeline, providing facilities such as high-resolution timers.
18 sched_clock() is used for scheduling and timestamping, and delay timers
23 -------------
26 tells you where you are in time. For example issuing the command 'date' on
31 n bits which count from 0 to (2^n)-1 and then wraps around to 0 and start over.
35 The clock source shall have as high resolution as possible, and the frequency
36 shall be as stable and correct as possible as compared to a real-world wall
37 clock. It should not move unpredictably back and forth in time or miss a few
38 cycles here and there.
40 It must be immune to the kind of effects that occur in hardware where e.g.
41 the counter register is read in two phases on the bus lowest 16 bits first
42 and the higher 16 bits in a second bus cycle with the counter bits
43 potentially being updated in between leading to the risk of very strange
46 When the wall-clock accuracy of the clock source isn't satisfactory, there
47 are various quirks and layers in the timekeeping code for e.g. synchronizing
48 the user-visible time to RTC clocks in the system or against networked time
56 Since this operation may be invoked very often, doing this in a strict
59 multiply and shift, so in clocksource_cyc2ns() you find:
63 You will find a number of helper functions in the clock source code intended
64 to aid in providing these mult and shift values, such as
66 mult factor from a fixed shift, and clocksource_register_hz() and
67 clocksource_register_khz() which will help out assigning both shift and mult
72 location, bit width, a parameter telling whether the counter in the
73 register counts up or down, and the timer clock rate, and then conjure all
76 Since a 32-bit counter at say 100 MHz will wrap around to zero after some 43
80 code knows when the counter will wrap around and can insert the necessary
86 ------------
89 desired time specification value and calculate the values to poke into
93 and register range may be used for the clock event, but it is essentially
96 system, it is ideal (and customary) to have one such event driving timer per
101 idea about translating counters to nanoseconds using mult and shift
102 arithmetic, and you find the same family of helper functions again for
109 -------------
111 In addition to the clock sources and clock events there is a special weak
112 function in the kernel called sched_clock(). This function shall return the
119 determining the absolute timeslice for a certain process in the CFS scheduler
121 include time information in printk for things like bootcharts.
124 much more often, especially by the scheduler. If you have to do trade-offs
126 for speed in sched_clock(). It however requires some of the same basic
136 and will likely show up in system benchmarks.
140 events on the system. However it may result in interesting timestamps in
143 The sched_clock() function should be callable in any context, IRQ- and
144 NMI-safe and return a sane value in any context.
146 Some architectures may have a limited set of time sources and lack a nice
147 counter to derive a 64-bit nanosecond value, so for example on the ARM
149 sched_clock() nanosecond base from a 16- or 32-bit counter. Sometimes the
155 drift between the CPUs on the system. The kernel can work around this by
161 --------------------------------------
174 Enter timer-based delays. Using these, a timer read may be used instead of
175 a hard-coded loop for providing the desired delay.
177 This is done by declaring a struct delay_timer and assigning the appropriate
178 function pointers and rate settings for this delay timer.