feat(posix): implement times accounting #24190
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24190"
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 DonRyuzaki on 2026-11-20T09:51:23Z.
What
Provide the exact
timesimport listed for Azahar in RetroArch PPSA99169 in #5927's grouped inventory. FreeBSD 11.4 reports process user and system CPU time plus a monotonic return value in 128 ticks per second. Its x86-64clock_tis signed 32-bit, making the four-fieldtmslayout 16 bytes. This implementation converts host process CPU accounting to those ticks, uses AnyPS5's existing guest monotonic nanosecond source for the return, and writes the result through checked guest access. Terminated-child counters remain zero, consistent with the current guestgetrusage(RUSAGE_CHILDREN)behavior. The debt fragment records the unverified guest child accounting and console provider.Tested
Windows 11, WinLibs GCC 15.2, Release: the focused test failed to link on
times_nid_postfixbefore implementation. With the implementation,guest_posix_times_testsbuilt andctest -R ^guest_posix_times$passed (1/1). It checks the 16-byte layout, nondecreasing process CPU counters, advancing 128 Hz monotonic ticks, zero guest child counters, null and unwritable outputs, and preserved errno. The compiled PE export table containstimes_nid_postfix.Linux WSL2, GCC 13.3, Release:
guest_posix_times_testsbuilt andctest -R ^guest_posix_times$passed (1/1). The exact-name scan found notimesdeclaration on main or 2,029 open PRs. The final branch scan compared 2,040 open PRs: all eight shared-file branches merged cleanly into the base. It could not merge older #22903'sApi.hpppatch, which was manually checked and contains notimesdeclaration. Conventions, debt fold, and diff checks passed on the final head. No Azahar or console run.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)timesimport; other imports remain)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T09:54:54Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
2ee9d589d0:tools/check_conventions.pypassed.guest_posix_times_testsbuilt cleanly.guest_posix_times):core/libs/prx/libScePosixForWebKit/include/Api.hpp,core/libs/prx/libScePosixForWebKit/Times.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T09:55:18Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
2ee9d589d0fb4f255025fe8168d2fe86a2c5280e. I inspected the prepared diff and all six changed files, plus targeted guest memory and monotonic clock helper code. No commands or tests were run.Results
Negative control
Not run; no tests were run during this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
No build, test, or console run was performed by this reviewer. The Windows and Linux test results and export scan in the PR description are author-reported, not independently confirmed. All six changed files listed in the manifest were read; no changed files were excluded.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-20T13:20:12Z.
Review: APPROVED
Windows check of head
2ee9d589d0with GCC 16, merged ontomain0a025bd3c6(clean merge).Setup: Windows 11 Home 10.0.26200, Ryzen 7 7700X, WinLibs GCC 16.2.0 (
x86_64-ucrt-posix-seh, r3), CMake 4.4.4, Ninja 1.13.2, Release full build, run from PowerShell. This was built together with #23341 and #21969, which touch other files.^guest_(posix|fnmatch)):main31 of 31, and with this PR 32 of 32 in 3 of 3 runs. The new one isguest_posix_times, which exercises theGetProcessTimespath here.return Tick32(... / 7812500)→return 0),guest_posix_timesaborts (0xc0000409) atafter > before.One optional note: a null or unwritable
tmspointer throwsstd::invalid_argument, where FreeBSD'stimeswould fail withEFAULT. That's in line with throwing when the console's answer isn't measured, but the debt entry doesn't mention it yet.AI-assisted: yes (Claude Code)