Linux Audio

Check our new training course

Linux debugging, profiling, tracing and performance analysis training

Apr 14-17, 2025
Register
Loading...
v3.15
 
 1#ifndef _TIMEKEEPING_INTERNAL_H
 2#define _TIMEKEEPING_INTERNAL_H
 
 
 
 
 
 3/*
 4 * timekeeping debug functions
 5 */
 6#include <linux/time.h>
 7
 8#ifdef CONFIG_DEBUG_FS
 9extern void tk_debug_account_sleep_time(struct timespec *t);
 
 
 
 
 
 
 
 
 
10#else
 
11#define tk_debug_account_sleep_time(x)
 
 
 
 
 
12#endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
14#endif /* _TIMEKEEPING_INTERNAL_H */
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _TIMEKEEPING_INTERNAL_H
 3#define _TIMEKEEPING_INTERNAL_H
 4
 5#include <linux/clocksource.h>
 6#include <linux/spinlock.h>
 7#include <linux/time.h>
 8
 9/*
10 * timekeeping debug functions
11 */
 
 
12#ifdef CONFIG_DEBUG_FS
13
14DECLARE_PER_CPU(unsigned long, timekeeping_mg_floor_swaps);
15
16static inline void timekeeping_inc_mg_floor_swaps(void)
17{
18	this_cpu_inc(timekeeping_mg_floor_swaps);
19}
20
21extern void tk_debug_account_sleep_time(const struct timespec64 *t);
22
23#else
24
25#define tk_debug_account_sleep_time(x)
26
27static inline void timekeeping_inc_mg_floor_swaps(void)
28{
29}
30
31#endif
32
33static inline u64 clocksource_delta(u64 now, u64 last, u64 mask, u64 max_delta)
34{
35	u64 ret = (now - last) & mask;
36
37	/*
38	 * Prevent time going backwards by checking the result against
39	 * @max_delta. If greater, return 0.
40	 */
41	return ret > max_delta ? 0 : ret;
42}
43
44/* Semi public for serialization of non timekeeper VDSO updates. */
45unsigned long timekeeper_lock_irqsave(void);
46void timekeeper_unlock_irqrestore(unsigned long flags);
47
48#endif /* _TIMEKEEPING_INTERNAL_H */