Lines Matching +full:clock +full:- +full:mult
1 // SPDX-License-Identifier: GPL-2.0
4 * counters to full 64-bit ns values.
13 #include <linux/sched/clock.h>
23 * struct clock_data - all data needed for sched_clock() (including
24 * registration of a new clock source)
29 * @wrap_kt: Duration for which clock can run before wrapping.
30 * @rate: Tick rate of the registered clock.
31 * @actual_read_sched_clock: Registered hardware level clock read function.
35 * into a single 64-byte cache line.
47 static int irqtime = -1;
54 * We don't need to use get_jiffies_64 on 32-bit arches here in jiffy_sched_clock_read()
57 return (u64)(jiffies - INITIAL_JIFFIES); in jiffy_sched_clock_read()
61 .read_data[0] = { .mult = NSEC_PER_SEC / HZ,
66 static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift) in cyc_to_ns() argument
68 return (cyc * mult) >> shift; in cyc_to_ns()
91 cyc = (rd->read_sched_clock() - rd->epoch_cyc) & in sched_clock()
92 rd->sched_clock_mask; in sched_clock()
93 res = rd->epoch_ns + cyc_to_ns(cyc, rd->mult, rd->shift); in sched_clock()
100 * Updating the data required to read the clock.
102 * sched_clock() will never observe mis-matched data even if called from
136 ns = rd.epoch_ns + cyc_to_ns((cyc - rd.epoch_cyc) & rd.sched_clock_mask, rd.mult, rd.shift); in update_sched_clock()
167 /* Calculate the mult/shift to convert counter ticks to ns. */ in sched_clock_register()
182 ns = rd.epoch_ns + cyc_to_ns((cyc - rd.epoch_cyc) & rd.sched_clock_mask, rd.mult, rd.shift); in sched_clock_register()
187 rd.mult = new_mult; in sched_clock_register()
195 /* update timeout for clock wrap */ in sched_clock_register()
220 if (irqtime > 0 || (irqtime == -1 && rate >= 1000000)) in sched_clock_register()
249 * Clock read function for use when the clock is suspended.
251 * This function makes it appear to sched_clock() as if the clock
272 rd->read_sched_clock = suspended_sched_clock_read; in sched_clock_suspend()
281 rd->epoch_cyc = cd.actual_read_sched_clock(); in sched_clock_resume()
283 rd->read_sched_clock = cd.actual_read_sched_clock; in sched_clock_resume()