Lines Matching +full:clock +full:- +full:mult

1 // SPDX-License-Identifier: GPL-2.0
4 * counters to full 64-bit ns values.
14 #include <linux/sched/clock.h>
24 * struct clock_data - all data needed for sched_clock() (including
25 * registration of a new clock source)
30 * @wrap_kt: Duration for which clock can run before wrapping.
31 * @rate: Tick rate of the registered clock.
32 * @actual_read_sched_clock: Registered hardware level clock read function.
36 * into a single 64-byte cache line.
48 static int irqtime = -1;
55 * We don't need to use get_jiffies_64 on 32-bit arches here in jiffy_sched_clock_read()
58 return (u64)(jiffies - INITIAL_JIFFIES); in jiffy_sched_clock_read()
62 .read_data[0] = { .mult = NSEC_PER_SEC / HZ,
67 static __always_inline u64 cyc_to_ns(u64 cyc, u32 mult, u32 shift) in cyc_to_ns() argument
69 return (cyc * mult) >> shift; in cyc_to_ns()
93 cyc = (rd->read_sched_clock() - rd->epoch_cyc) & in __sched_clock()
94 rd->sched_clock_mask; in __sched_clock()
95 res = rd->epoch_ns + cyc_to_ns(cyc, rd->mult, rd->shift); in __sched_clock()
123 * Updating the data required to read the clock.
125 * sched_clock() will never observe mis-matched data even if called from
161 ns = rd.epoch_ns + cyc_to_ns((cyc - rd.epoch_cyc) & rd.sched_clock_mask, rd.mult, rd.shift); in update_sched_clock()
191 /* Calculate the mult/shift to convert counter ticks to ns. */ in sched_clock_register()
206 ns = rd.epoch_ns + cyc_to_ns((cyc - rd.epoch_cyc) & rd.sched_clock_mask, rd.mult, rd.shift); in sched_clock_register()
211 rd.mult = new_mult; in sched_clock_register()
219 /* update timeout for clock wrap */ in sched_clock_register()
242 if (irqtime > 0 || (irqtime == -1 && rate >= 1000000)) in sched_clock_register()
271 * Clock read function for use when the clock is suspended.
273 * This function makes it appear to sched_clock() as if the clock
294 rd->read_sched_clock = suspended_sched_clock_read; in sched_clock_suspend()
303 rd->epoch_cyc = cd.actual_read_sched_clock(); in sched_clock_resume()
305 rd->read_sched_clock = cd.actual_read_sched_clock; in sched_clock_resume()