test(libkernel): check clock_getres for the wall, monotonic and uptime clocks #9658
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9658"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T06:44:42Z.
What
guest_freebsd_clockscheckedclock_getresvalues only for the virtual and profiling clocks, through itsResolutionNanoshelper. Line coverage of the Windows build showed that the Windows branches ofclock_getres(Time.cpp:551-566) never ran with a result pointer:CLOCK_REALTIME/CLOCK_REALTIME_PRECISE;QueryPerformanceFrequencyresolution of the monotonic, uptime and fast clocks.How:
tests/GuestFreebsdClocks.cpp: names the FreeBSD clock ids 5, 7, 8, 10, 11 and 12. A new check runs the existingResolutionNanoshelper onCLOCK_REALTIME,_PRECISE,_FAST,CLOCK_MONOTONIC,_PRECISE,_FAST,CLOCK_UPTIME,_PRECISEand_FAST. For each it requires success,tv_sec == 0,0 < tv_nsec < 1 s, and the same value fromsceKernelClockGetres.Tested
guest_freebsd_clockspasses.tv_nsec = 0: the test fails;0: the test fails.CLOCK_REALTIME_COARSEwhere available). Its resolution is below a second there too, but Linux was not run locally; CI runs it.tools/check_conventions.pypasses.Overlap (
tools/pr_overlap.py --branchplusgit merge-tree):Time.cppandGuestThreadCpuClock.cppfor the process and thread CPU clocks. This test leaves those clocks out, andgit merge-treeadds no conflict.mainin this file; it gets no new hunk.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T09:11:22Z.
Review: CHANGES_REQUESTED
The added clock IDs match the FreeBSD values used by the Windows implementation, and
ResolutionNanoschecks both APIs return the same valid subsecond value. The author reports Windows 11 runs with negative controls for both resolution branches. Exact-head diff-check and conventions pass; hosted conventions, eligibility, intake and labels pass, while platform test jobs are skipped.I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T09:21:06Z.
Thanks for the review, @MarcZX10.
On the intake point: this is a test-only PR, the first coverage of the Windows
clock_getresbranches, which a line-coverage run of the Windows build showed never ran. It has negative controls for both branches. No title is known to stop on these clocks, soUnblocksstaysnone. If a maintainer asks on this PR to hold it, I'll convert it to a draft right away.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T12:40:38Z.
Review: CHANGES_REQUESTED
The added clock IDs and calls through
ResolutionNanosare consistent with the Windowsclock_getresbranches described here, and the reported negative controls are useful evidence. The current PR base isd6eafa54, however, while upstreammainis now8b3a6ba(15 commits ahead).CONTRIBUTING.mdrequires branches to be based on and kept up to date with currentmain, so please rebase this test onto currentmainand rerunguest_freebsd_clockson the resulting Windows build. The current hosted Linux/Windows product jobs are skipped, and the Windows results in the description are for the older base. I found no issue with the test logic itself.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-25T06:59:04Z.
Review: APPROVED
Reviewed
ff46432826c17f2156cf862c3a5ba5326a4b0df0against author merge base4a17c71757644170c6a0acfcc67fb17f81cff93f.Approve. No actionable findings in this focused test-only change.
The nine added wall/monotonic/uptime clock IDs reuse ResolutionNanos, which checks a positive subsecond resolution and equality of POSIX and SCE wrappers. Reviewed their pinned Time.cpp dispatch: Windows uses its wall or performance-counter resolution for these IDs, and sceKernelClockGetres delegates to the same implementation. The existing whole-second clock test remains separate.
Validation: head/baseline GCC syntax checks passed. The exact added helper and original ResolutionNanos/Require logic were extracted with original declarations/constants, compiled, and executed successfully against the existing development libkernel/libc DLLs. This is compatibility evidence for the new calls, not a pinned production rebuild or a full clocks-suite pass; the full suite could not link to the old DLL because of unrelated missing clock_settime. Conventions, whitespace and registration passed. Hosted native jobs were skipped.