Lines Matching +full:clock +full:- +full:duration +full:- +full:ns

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()
93 cyc = (rd->read_sched_clock() - rd->epoch_cyc) & in sched_clock_noinstr()
94 rd->sched_clock_mask; in sched_clock_noinstr()
95 res = rd->epoch_ns + cyc_to_ns(cyc, rd->mult, rd->shift); in sched_clock_noinstr()
103 unsigned long long ns; in sched_clock() local
105 ns = sched_clock_noinstr(); in sched_clock()
107 return ns; in sched_clock()
111 * Updating the data required to read the clock.
113 * sched_clock() will never observe mis-matched data even if called from
141 u64 ns; in update_sched_clock() local
147 ns = rd.epoch_ns + cyc_to_ns((cyc - rd.epoch_cyc) & rd.sched_clock_mask, rd.mult, rd.shift); in update_sched_clock()
149 rd.epoch_ns = ns; in update_sched_clock()
166 u64 res, wrap, new_mask, new_epoch, cyc, ns; in sched_clock_register() local
178 /* Calculate the mult/shift to convert counter ticks to ns. */ in sched_clock_register()
193 ns = rd.epoch_ns + cyc_to_ns((cyc - rd.epoch_cyc) & rd.sched_clock_mask, rd.mult, rd.shift); in sched_clock_register()
201 rd.epoch_ns = ns; in sched_clock_register()
206 /* update timeout for clock wrap */ in sched_clock_register()
222 /* Calculate the ns resolution of this counter */ in sched_clock_register()
229 if (irqtime > 0 || (irqtime == -1 && rate >= 1000000)) in sched_clock_register()
258 * Clock read function for use when the clock is suspended.
260 * This function makes it appear to sched_clock() as if the clock
281 rd->read_sched_clock = suspended_sched_clock_read; in sched_clock_suspend()
290 rd->epoch_cyc = cd.actual_read_sched_clock(); in sched_clock_resume()
292 rd->read_sched_clock = cd.actual_read_sched_clock; in sched_clock_resume()