Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\time\sched_clock.c Create Date:2022-07-28 10:51:26
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:sched_clock_register

Proto:void __init sched_clock_register(u64 (*read)(void ), int bits, unsigned long rate)

Type:void

Parameter:

TypeParameterName
u64 (*read
intbits
unsigned longrate
176  If rate > rate Then Return
179  WARN_ON(!Some architectures don't define arch_irqs_disabled(), so even if either* definition would be fine we need to use different ones for the time being* to avoid build issues.())
182  locks_calc_mult_shift - calculate mult/shift factors for scaled math of clocks*@mult: pointer to mult variable*@shift: pointer to shift variable*@from: frequency to convert from*@to: frequency to convert to*@maxsec: guaranteed runtime conversion range in
184  new_mask = simplify initialization of mask field (bits)
185  rate = rate
188  wrap = locks_calc_max_nsecs - Returns maximum nanoseconds that can be converted*@mult: cycle to nanosecond multiplier*@shift: cycle to nanosecond divisor (power of two)*@maxadj: maximum adjustment value to mult (~11%)*@mask: bitmask for two's complement
189  wrap_kt = ns_to_ktime(wrap)
191  rd = read_data[0]
194  new_epoch = read()
195  cyc = actual_read_sched_clock()
196  ns = epoch_ns + cyc_to_ns((cyc - epoch_cyc) & sched_clock_mask, mult, shift)
197  actual_read_sched_clock = read
199  read_sched_clock = read
200  sched_clock_mask = new_mask
201  mult = new_mult
202  shift = new_shift
203  epoch_cyc = new_epoch
204  epoch_ns = ns
206  Updating the data required to read the clock
208  If (function != NULL) Then
210  hrtimer_start - (re)start an hrtimer*@timer: the timer to be added*@tim: expiry time*@mode: timer mode: absolute (HRTIMER_MODE_ABS) or* relative (HRTIMER_MODE_REL), and pinned (HRTIMER_MODE_PINNED);* softirq based mode is considered for debug purpose only!
213  r = rate
214  If r >= 4000000 Then
215  r /= 1000000
216  r_unit = 'M'
217  Else
218  If r >= 1000 Then
219  r /= 1000
220  r_unit = 'k'
221  Else
222  r_unit = ' '
227  res = cyc_to_ns(1ULL, new_mult, new_shift)
229  pr_info("sched_clock: %u bits at %lu%cHz, resolution %lluns, wraps every %lluns\n", bits, r, r_unit, res, wrap)
233  If irqtime > 0 || irqtime == -1 && rate >= 1000000 Then enable_sched_clock_irqtime()
236  pr_debug("Registered %pS as sched_clock source\n", read)
Caller
NameDescribe
generic_sched_clock_init