linux/tools/testing/selftests/timers
John Stultz b00385b8d0 selftests/posix_timers: Use CLOCK_THREAD_CPUTIME_ID for ITIMER_PROF measurements
It was reported that the posix_timers test was at times seeing failures
with ITIMER_PROF timers, specifically in cases where the RCU_SOFTIRQ was
taking up significant amounts of time.

Analysis showed that as the time in softirq isn't included in the task
stime + utime accounting used to trigger the SIGPROF so delays from softirq
work could cause it to appear that the signal was incorrectly delayed.

Contributing to this is that the test uses gettimeofday() to measure
itimers, which also means any scheduling delay can also cause failures (as
the task may not be running the entire time).

To fix this, convert all the itimer measurements to use clock_gettime(),
tweaking the logic to use nsecs instead of usecs. Then for ITIMER_PROF
timers, utilize the CLOCK_THREAD_CPUTIME_ID clockid so that it is similarly
measuring the time the task was running.

Signed-off-by: John Stultz <jstultz@google.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260428173957.1394265-1-jstultz@google.com
2026-05-06 08:33:08 +02:00
..
.gitignore
adjtick.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
alarmtimer-suspend.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
change_skew.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
clocksource-switch.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
freq-step.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
inconsistency-check.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
leap-a-day.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
leapcrash.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
Makefile selftests: timers: Remove local NSEC_PER_SEC and USEC_PER_SEC defines 2024-10-14 16:15:12 -06:00
mqueue-lat.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
nanosleep.c Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
nsleep-lat.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
posix_timers.c selftests/posix_timers: Use CLOCK_THREAD_CPUTIME_ID for ITIMER_PROF measurements 2026-05-06 08:33:08 +02:00
raw_skew.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
rtcpie.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
set-2038.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
set-tai.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
set-timer-lat.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
set-tz.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
settings selftests/timers: Turn off timeout setting 2020-08-20 15:49:28 -06:00
skew_consistency.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
threadtest.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
valid-adjtimex.c selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00