diff options
| author | Jeff Layton <jlayton@kernel.org> | 2024-10-02 17:27:17 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2024-10-06 20:56:07 +0200 |
| commit | 96f9a366ec8abe027326d7aab84d64370019f0f1 (patch) | |
| tree | 4e5942795348ab2a7af967c4f9a5625e703f6063 /kernel/time/timekeeping_internal.h | |
| parent | timekeeping: Add interfaces for handling timestamps with a floor value (diff) | |
| download | linux-96f9a366ec8abe027326d7aab84d64370019f0f1.tar.gz linux-96f9a366ec8abe027326d7aab84d64370019f0f1.zip | |
timekeeping: Add percpu counter for tracking floor swap events
The mgtime_floor value is a global variable for tracking the latest
fine-grained timestamp handed out. Because it's a global, track the
number of times that a new floor value is assigned.
Add a new percpu counter to the timekeeping code to track the number of
floor swap events that have occurred. A later patch will add a debugfs
file to display this counter alongside other stats involving multigrain
timestamps.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # documentation bits
Link: https://lore.kernel.org/all/20241002-mgtime-v10-2-d1c4717f5284@kernel.org
Diffstat (limited to 'kernel/time/timekeeping_internal.h')
| -rw-r--r-- | kernel/time/timekeeping_internal.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/time/timekeeping_internal.h b/kernel/time/timekeeping_internal.h index 4ca2787d1642..0bbae825bc02 100644 --- a/kernel/time/timekeeping_internal.h +++ b/kernel/time/timekeeping_internal.h @@ -10,9 +10,24 @@ * timekeeping debug functions */ #ifdef CONFIG_DEBUG_FS + +DECLARE_PER_CPU(unsigned long, timekeeping_mg_floor_swaps); + +static inline void timekeeping_inc_mg_floor_swaps(void) +{ + this_cpu_inc(timekeeping_mg_floor_swaps); +} + extern void tk_debug_account_sleep_time(const struct timespec64 *t); + #else + #define tk_debug_account_sleep_time(x) + +static inline void timekeeping_inc_mg_floor_swaps(void) +{ +} + #endif #ifdef CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE |
