fix(libc): count clock() as the process time, like the console #9677

Merged
JJenkx merged 3 commits from upstream-pr/9677 into main 2026-11-14 03:33:08 +00:00
JJenkx commented 2026-10-22 07:49:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T07:49:18Z.


What

clock() now returns sceKernelGetProcessTime(), the microseconds since the process started. On main it returned the host process CPU time (GetProcessTimes on Windows, std::clock elsewhere).

The libc.prx that titles ship implements clock (QZP6I9ZZxpE) as an 11-byte tail call to sceKernelGetProcessTime (4J2sUJmuHZQ), through the PLT. This was read from disassembly of the decrypted copies of PPSA13934 (0x6ba20), PPSA07923 (0x71790) and PPSA05916 (0x73ba0), not measured on a console. All three resolve the same PLT slot 0x50 to that NID.

CPU time is a different clock:

  • It barely moves while guest threads wait. In guest_process_time on main, clock() is 0 after about 60 ms of process time.
  • It runs ahead of real time while several host threads are busy, the emulator's own included.

So a title that times frames or animations with clock() saw time pass at the wrong rate. clock is imported by PPSA13934, PPSA05916, PPSA20423 and PPSA33655 among the titles converted here.

How

libc can't link libkernel, because libkernel already links libc. Instead, libkernel installs sceKernelGetProcessTime as libc's process time source in a static initialiser, through LibcSetProcessTimeSource_nid_no_patch, which follows LibcSetEndFlush_nid_no_patch. clock() returns that source's value, so it also follows APS5_TIME_SCALE. Until a source is installed, as in a test that links only libc, clock() counts host monotonic time from the load of libc. The libc.md entry records that path and the disassembly.

Tested

Current-main integration — 2026-11-09 UTC. Head c6d755c1f9c68cd2edd88dada51cec3e5e509ad2 preserves public head 6ac7ce9e401899294b07fd56eea0ec72a6fb0980 and integrates pinned main 7259cce11195f360698772da8c0b3af756bf7c8f. Conflict resolution retains both the topic and main's newer source/test/debt changes; maintainer commits and attribution remain intact.

Linux x86-64, GCC 16.2.1, Ninja Release: actual libc/libkernel and focused fixture owners rebuilt. 30/30 CPU executions pass, zero skips (10 groups × three repetitions): guest_process_time, guest_process_time_counter, guest_process_time_scaled, guest_process_time_counter_scaled, guest_process_time_tsc, guest_process_time_tsc_scaled, guest_process_time_rdtsc, guest_process_time_rdtsc_scaled, guest_freebsd_clocks, guest_kernel_sys. public_headers, conventions and whitespace checks pass. The matching plain-main control passed 102 selected CPU executions and its header audit. CPU fixtures execute unpatched production libraries; this is not a full SDK or patched-title runtime qualification.

No new Windows/macOS, console, GPU, title or performance result is claimed. Source checks preserve the existing production topic; historical reports below retain their original pins.

Build/test logs, exact heads, source/ancestry checks and provider pins, SHA-256 52727be6594b9c15bf9a5535fef374b985e9526aabe5f3ef5cf5857dfeeb1a0d. The public archive and all 178 manifest files were download/hash verified.

Main conflict refresh, 2026-10-27 10:18 UTC pass: exact head d72983464a9548932465743e5f485e4537ae64ae on tested main 3fea2a937ba9fbab2f06c51691fe0c5763659aa3. The topic production/test edits and current main's includes and checked-pointer behavior are preserved.

Linux Release focused rebuild: Four process-time registrations, FreeBSD clocks, kernel sys and public headers each pass three times: 21 passes, zero skips. Conventions, whitespace and merge checks pass. Every refreshed head's submodule pointers match the pinned main; the private dependency checkouts used for the gates are aligned. No new negative-control, Windows, console, title, GPU, full-suite or performance run is claimed. Earlier measurements below retain their original exact pins. Fulfilled merge-order dependencies have been cleared from the checklist; open prerequisites remain.

Exact source/dependency pins, patch-preservation and gitlink proofs, builds, verbose tests, JUnit and lease-push receipts. SHA-256: 702c4110ee9dde421c2dd5e057ed53a2df05e0cf7b01f67e8fb9cb779e332f7c; downloaded copy verified.

Conflict refresh, 2026-10-27 UTC: exact head a53a9ce4517f360c31a4fd14e7e9333dc8c15bf8 on tested main 74acfad65b3f0fd4eab653f3a3989d298fba1157. Preserved current main's API/header layout and pointer-checking code; removed a stale duplicate clock declaration from the test in favor of the API header. The branch remains one clock-policy topic and contains no private #11402/#11042 integration commits. The declared #11402 merge-order dependency remains.

Linux Release focused libraries/executables rebuilt. Seven groups (four process-time registrations, FreeBSD clocks, kernel sys, public headers) each pass three times: 21 initial and 21 restored passes. A clock-function-only main-production control fails the normal and scaled process-time fixtures while retaining the hook needed to link the test; restored libc is byte-identical. Zero skips; conventions and whitespace pass. This is focused Linux evidence, without new Windows, console, title, GPU or full-suite validation. Earlier measurements retain their original exact pins.

Source/dependency pins, production preservation, verbose build/test/control/restoration logs, JUnit, hashes and lease-push receipts. SHA-256: 594bf1dd3a57728c23dd0752926f501f34a8be8e31c8d924e6bec3723d029a82; downloaded copy verified.

Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 r7 (UCRT), Ninja, Release, -DBUILD_TESTING=ON, on main d6eafa54d0.

  • guest_process_time and guest_process_time_scaled (APS5_TIME_SCALE=0.5) now also require clock() to fall between two sceKernelGetProcessTime() calls made around it.
    • On main both fail with clock() is not the process time. A local print showed the process time at 60135..60137 µs with clock() 0, and at 25616..25617 µs with clock() 0 when scaled.
    • With this change, the four guest_process_time* tests pass in three runs out of three.
  • Full suite with the GPU hidden (VK_ICD_FILENAMES pointed at nothing), ctest -j16 --timeout 120: 1887 of 1890 pass. The failures are guest_raise_in_system_call and guest_raise_in_host_code, which time out on main here too (#9610), and patched_libraries, which passes once the toolchain's bin is on PATH, as on main (outside it LoadLibraryEx picks up another libstdc++).
  • python tools/check_conventions.py --base origin/main: passes.
  • tools/pr_overlap.py --branch: no direct overlap. #4627, #5021, #6879 and #7201 share files but don't touch clock.
  • Linux, run by @jotitadev (Ubuntu 26.04, glibc 2.43, GCC 15.2.0, Release, 280ae69a4 merged onto main 7e2ba73e4): guest_process_time* and patched_libraries pass 5/5. With the old clock() the two new checks abort; the 26 guest_*time*/*clock* tests and guest_kqueue pass.
  • Not tested: macOS, a console, a title run.

Current-main refresh (2026-10-24)

Head 15ba05f6e0c0198205b4c31f632c1ae8398513ad merges main 6cd36e651724f42b7b564544640187948e80c8cb into the existing branch. Only docs/dev/debt/libc.md conflicted: the resolution keeps the exact latest-main file, including its newly measured random-generator entry, plus this PR's single clock entry. The production and test added/removed lines are identical to the prior topic; main's TSC-frequency/conversion checks and this PR's clock bracketing remain together.

Fresh Linux 7.2.9 / Ryzen 9 7950X / GCC 16.2.1 Release: rebuilt the relevant libc/libkernel libraries and guest_process_time_tests. The normal process-time, counter, scaled-time and scaled-counter tests each pass three consecutive executions (12/12, no skips). Conventions and topic whitespace checks pass. This is a focused Linux refresh; earlier negative-control and Windows results remain at their original pins. No fresh Windows/macOS, full application, title or performance result is claimed. Windows remains user-paused.

Fresh build/test logs, JUnit, exact topic patch and scope review, SHA256 8f1769edab604b7a740ad296f2346138f385ee984b6511d13f84edaa948d1be0.

Integration with #6044

At #6044 head 5fa62e5960372f7caf378ce5e13912f1e0d3d514, GuestProcessTime.cpp moves from core/libs/tests/ to core/libs/tests/time/. This change does not require that reorganization; there is no dependency on #6044.

If #6044 lands first, I will rebase this PR, apply its libc include/declaration and bounded clock() assertions at the new path, and rerun all four guest_process_time* tests plus patched_libraries. If this PR lands first, the subsequent #6044 rebase must carry those assertions into the moved file. Keep the target's libc linkage and the normal/scaled test registrations in either order.

The moved file at that #6044 head also predates current main 4777caca343bf09a3fe245830acd9e9f433e8e18: it still assumes a fixed counter frequency. Conflict resolution must retain main's sceKernelGetProcessTimeCounterFrequency()/TSC-frequency check, frequency-based conversion and monotonic counter assertion as well as this PR's new clock() check. Accepting either older file wholesale would lose coverage. This is a source comparison and integration plan; no combined #6044 build/test is claimed.

Integration with #11402

Agreed order: #11402 first, then this PR rebases while retaining both GuestArena.hpp (checked reads) and GuestTime.hpp (process-time source). The exact-head conflict is in that include block. Keep #11402's checked copies: unreadable pointers return EFAULT before value validation; readable invalid requests return EINVAL. #11042 separately replaces the valid clock_settime descriptive throw with NotImplemented_nid_no_patch, after those checks. This PR's current head does not itself change that tail. Private integration previews preserve all three topics. Linux GCC16.2.1 Release builds of the exact two-topic merge 1284d9706f3cf2d3516dc7ff960a02cf7ad1a3fa and three-topic merge 0553b4cae9c7b29f48be88e389fba338da0990d5 each pass all four guest_process_time* registrations plus guest_freebsd_clocks and guest_kernel_sys three times (18 passes per preview, no skips). These contain main 4b1a9a3b2f51efe6fcde289ba0788f3cfffe2f32; they verify integration at those pins, without claiming a newest-main rebase of this public branch.

Current rebase qualification (2026-10-28)

Refreshed onto main 2227f1366188cda5699dd20e2e756a18006a5d4b as 6ac7ce9e401899294b07fd56eea0ec72a6fb0980. The topic production and test additions/removals are preserved; the include/debt conflicts retain both sides. #11402 is now merged: its checked time-pointer reads, EFAULT-before-EINVAL validation and valid-request diagnostic guard are retained unchanged; this topic no longer changes clock_settime.

Linux Release: libc/libkernel and three clock test executables build. Seven focused groups, including scaled and counter clock variants, FreeBSD clock validation, kernel syscalls and public headers, pass three repetitions (21 executions), zero skips. Conventions and whitespace pass. Existing Windows/reference evidence remains pinned to its original heads; no new title/GPU/performance result. AI-assisted: yes.

Source-preservation proofs, builds, controls, logs and JUnit, SHA-256 17fa7113ae7732ef2704bcb76e11ef6528c6fd74684037c27fb1a5b516ce9988. Existing historical platform and title measurements retain their original source pins.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source: none added
  • Generic behaviour, not specific to one title
  • Depends on: none (#11402 merged at 7f02cb180227; present in audited main 3fea2a937ba)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4963955204 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-22T07:49:18Z. --- ### What `clock()` now returns `sceKernelGetProcessTime()`, the microseconds since the process started. On `main` it returned the host process CPU time (`GetProcessTimes` on Windows, `std::clock` elsewhere). The `libc.prx` that titles ship implements `clock` (`QZP6I9ZZxpE`) as an 11-byte tail call to `sceKernelGetProcessTime` (`4J2sUJmuHZQ`), through the PLT. This was read from disassembly of the decrypted copies of PPSA13934 (0x6ba20), PPSA07923 (0x71790) and PPSA05916 (0x73ba0), not measured on a console. All three resolve the same PLT slot 0x50 to that NID. CPU time is a different clock: - It barely moves while guest threads wait. In `guest_process_time` on `main`, `clock()` is 0 after about 60 ms of process time. - It runs ahead of real time while several host threads are busy, the emulator's own included. So a title that times frames or animations with `clock()` saw time pass at the wrong rate. `clock` is imported by PPSA13934, PPSA05916, PPSA20423 and PPSA33655 among the titles converted here. ### How libc can't link libkernel, because libkernel already links libc. Instead, libkernel installs `sceKernelGetProcessTime` as libc's process time source in a static initialiser, through `LibcSetProcessTimeSource_nid_no_patch`, which follows `LibcSetEndFlush_nid_no_patch`. `clock()` returns that source's value, so it also follows `APS5_TIME_SCALE`. Until a source is installed, as in a test that links only libc, `clock()` counts host monotonic time from the load of libc. The `libc.md` entry records that path and the disassembly. ### Tested <!-- codex-maintenance-20261109-cpu-9677 --> **Current-main integration — 2026-11-09 UTC.** Head `c6d755c1f9c68cd2edd88dada51cec3e5e509ad2` preserves public head `6ac7ce9e401899294b07fd56eea0ec72a6fb0980` and integrates pinned main `7259cce11195f360698772da8c0b3af756bf7c8f`. Conflict resolution retains both the topic and main's newer source/test/debt changes; maintainer commits and attribution remain intact. Linux x86-64, GCC 16.2.1, Ninja Release: actual libc/libkernel and focused fixture owners rebuilt. **30/30 CPU executions pass, zero skips** (10 groups × three repetitions): `guest_process_time`, `guest_process_time_counter`, `guest_process_time_scaled`, `guest_process_time_counter_scaled`, `guest_process_time_tsc`, `guest_process_time_tsc_scaled`, `guest_process_time_rdtsc`, `guest_process_time_rdtsc_scaled`, `guest_freebsd_clocks`, `guest_kernel_sys`. `public_headers`, conventions and whitespace checks pass. The matching plain-main control passed 102 selected CPU executions and its header audit. CPU fixtures execute unpatched production libraries; this is not a full SDK or patched-title runtime qualification. No new Windows/macOS, console, GPU, title or performance result is claimed. Source checks preserve the existing production topic; historical reports below retain their original pins. [Build/test logs, exact heads, source/ancestry checks and provider pins](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/cpu8-main7259-linux-20261109.tar.gz), SHA-256 `52727be6594b9c15bf9a5535fef374b985e9526aabe5f3ef5cf5857dfeeb1a0d`. The public archive and all 178 manifest files were download/hash verified. <!-- codex-main-refresh-20261027-1018-pr9677 --> **Main conflict refresh, 2026-10-27 10:18 UTC pass:** exact head `d72983464a9548932465743e5f485e4537ae64ae` on tested main `3fea2a937ba9fbab2f06c51691fe0c5763659aa3`. The topic production/test edits and current main's includes and checked-pointer behavior are preserved. Linux Release focused rebuild: Four process-time registrations, FreeBSD clocks, kernel sys and public headers each pass three times: 21 passes, zero skips. Conventions, whitespace and merge checks pass. Every refreshed head's submodule pointers match the pinned main; the private dependency checkouts used for the gates are aligned. No new negative-control, Windows, console, title, GPU, full-suite or performance run is claimed. Earlier measurements below retain their original exact pins. Fulfilled merge-order dependencies have been cleared from the checklist; open prerequisites remain. [Exact source/dependency pins, patch-preservation and gitlink proofs, builds, verbose tests, JUnit and lease-push receipts](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-cpu11-main3fea-linux-20261027-1018.tar.gz). SHA-256: `702c4110ee9dde421c2dd5e057ed53a2df05e0cf7b01f67e8fb9cb779e332f7c`; downloaded copy verified. <!-- codex-main-refresh-20261027-pr9677 --> **Conflict refresh, 2026-10-27 UTC:** exact head `a53a9ce4517f360c31a4fd14e7e9333dc8c15bf8` on tested main `74acfad65b3f0fd4eab653f3a3989d298fba1157`. Preserved current main's API/header layout and pointer-checking code; removed a stale duplicate clock declaration from the test in favor of the API header. The branch remains one clock-policy topic and contains no private #11402/#11042 integration commits. The declared #11402 merge-order dependency remains. Linux Release focused libraries/executables rebuilt. Seven groups (four process-time registrations, FreeBSD clocks, kernel sys, public headers) each pass three times: 21 initial and 21 restored passes. A clock-function-only main-production control fails the normal and scaled process-time fixtures while retaining the hook needed to link the test; restored libc is byte-identical. Zero skips; conventions and whitespace pass. This is focused Linux evidence, without new Windows, console, title, GPU or full-suite validation. Earlier measurements retain their original exact pins. [Source/dependency pins, production preservation, verbose build/test/control/restoration logs, JUnit, hashes and lease-push receipts](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-formatting-clock-rand-main74ac-linux-20261027.tar.gz). SHA-256: `594bf1dd3a57728c23dd0752926f501f34a8be8e31c8d924e6bec3723d029a82`; downloaded copy verified. Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 r7 (UCRT), Ninja, Release, `-DBUILD_TESTING=ON`, on `main` d6eafa54d0. - `guest_process_time` and `guest_process_time_scaled` (`APS5_TIME_SCALE=0.5`) now also require `clock()` to fall between two `sceKernelGetProcessTime()` calls made around it. - On `main` both fail with `clock() is not the process time`. A local print showed the process time at 60135..60137 µs with `clock()` 0, and at 25616..25617 µs with `clock()` 0 when scaled. - With this change, the four `guest_process_time*` tests pass in three runs out of three. - Full suite with the GPU hidden (`VK_ICD_FILENAMES` pointed at nothing), `ctest -j16 --timeout 120`: 1887 of 1890 pass. The failures are `guest_raise_in_system_call` and `guest_raise_in_host_code`, which time out on `main` here too (#9610), and `patched_libraries`, which passes once the toolchain's `bin` is on `PATH`, as on `main` (outside it `LoadLibraryEx` picks up another `libstdc++`). - `python tools/check_conventions.py --base origin/main`: passes. - `tools/pr_overlap.py --branch`: no direct overlap. #4627, #5021, #6879 and #7201 share files but don't touch `clock`. - Linux, run by @jotitadev (Ubuntu 26.04, glibc 2.43, GCC 15.2.0, Release, 280ae69a4 merged onto `main` 7e2ba73e4): `guest_process_time*` and `patched_libraries` pass 5/5. With the old `clock()` the two new checks abort; the 26 `guest_*time*`/`*clock*` tests and `guest_kqueue` pass. - Not tested: macOS, a console, a title run. ### Current-main refresh (2026-10-24) Head `15ba05f6e0c0198205b4c31f632c1ae8398513ad` merges main `6cd36e651724f42b7b564544640187948e80c8cb` into the existing branch. Only `docs/dev/debt/libc.md` conflicted: the resolution keeps the exact latest-main file, including its newly measured random-generator entry, plus this PR's single clock entry. The production and test added/removed lines are identical to the prior topic; main's TSC-frequency/conversion checks and this PR's clock bracketing remain together. Fresh Linux 7.2.9 / Ryzen 9 7950X / GCC 16.2.1 Release: rebuilt the relevant libc/libkernel libraries and `guest_process_time_tests`. The normal process-time, counter, scaled-time and scaled-counter tests each pass three consecutive executions (12/12, no skips). Conventions and topic whitespace checks pass. This is a focused Linux refresh; earlier negative-control and Windows results remain at their original pins. No fresh Windows/macOS, full application, title or performance result is claimed. Windows remains user-paused. [Fresh build/test logs, JUnit, exact topic patch and scope review](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/pr9677-head15ba05f6-linux-refresh.tar.gz), SHA256 `8f1769edab604b7a740ad296f2346138f385ee984b6511d13f84edaa948d1be0`. ### Integration with #6044 At #6044 head `5fa62e5960372f7caf378ce5e13912f1e0d3d514`, `GuestProcessTime.cpp` moves from `core/libs/tests/` to `core/libs/tests/time/`. This change does not require that reorganization; there is no dependency on #6044. If #6044 lands first, I will rebase this PR, apply its libc include/declaration and bounded `clock()` assertions at the new path, and rerun all four `guest_process_time*` tests plus `patched_libraries`. If this PR lands first, the subsequent #6044 rebase must carry those assertions into the moved file. Keep the target's libc linkage and the normal/scaled test registrations in either order. The moved file at that #6044 head also predates current main `4777caca343bf09a3fe245830acd9e9f433e8e18`: it still assumes a fixed counter frequency. Conflict resolution must retain main's `sceKernelGetProcessTimeCounterFrequency()`/TSC-frequency check, frequency-based conversion and monotonic counter assertion as well as this PR's new `clock()` check. Accepting either older file wholesale would lose coverage. This is a source comparison and integration plan; no combined #6044 build/test is claimed. ### Integration with #11402 Agreed order: #11402 first, then this PR rebases while retaining both `GuestArena.hpp` (checked reads) and `GuestTime.hpp` (process-time source). The exact-head conflict is in that include block. Keep #11402's checked copies: unreadable pointers return `EFAULT` before value validation; readable invalid requests return `EINVAL`. #11042 separately replaces the valid `clock_settime` descriptive throw with `NotImplemented_nid_no_patch`, after those checks. This PR's current head does not itself change that tail. Private integration previews preserve all three topics. Linux GCC16.2.1 Release builds of the exact two-topic merge `1284d9706f3cf2d3516dc7ff960a02cf7ad1a3fa` and three-topic merge `0553b4cae9c7b29f48be88e389fba338da0990d5` each pass all four `guest_process_time*` registrations plus `guest_freebsd_clocks` and `guest_kernel_sys` three times (18 passes per preview, no skips). These contain main `4b1a9a3b2f51efe6fcde289ba0788f3cfffe2f32`; they verify integration at those pins, without claiming a newest-main rebase of this public branch. <!-- codex-rebase-20261028-repeat-pr9677 --> ### Current rebase qualification (2026-10-28) Refreshed onto `main` `2227f1366188cda5699dd20e2e756a18006a5d4b` as `6ac7ce9e401899294b07fd56eea0ec72a6fb0980`. The topic production and test additions/removals are preserved; the include/debt conflicts retain both sides. #11402 is now merged: its checked time-pointer reads, EFAULT-before-EINVAL validation and valid-request diagnostic guard are retained unchanged; this topic no longer changes `clock_settime`. Linux Release: libc/libkernel and three clock test executables build. Seven focused groups, including scaled and counter clock variants, FreeBSD clock validation, kernel syscalls and public headers, pass three repetitions (21 executions), zero skips. Conventions and whitespace pass. Existing Windows/reference evidence remains pinned to its original heads; no new title/GPU/performance result. AI-assisted: yes. [Source-preservation proofs, builds, controls, logs and JUnit](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/cpu-http-qualified-linux-20261028.tar.gz), SHA-256 `17fa7113ae7732ef2704bcb76e11ef6528c6fd74684037c27fb1a5b516ce9988`. Existing historical platform and title measurements retain their original source pins. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source: none added - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#11402 merged at `7f02cb180227`; present in audited main `3fea2a937ba`) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes AI-assisted (Claude Code).
MarcZX10 commented 2026-10-22 08:52:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T08:52:49Z.

Review: APPROVED


Reviewed the clock() implementation, linkage path, test addition, and reported CI/test results. The change follows the console libc behavior documented from three title library disassemblies, routes through the existing process-time source, and adds a bounded regression assertion in both normal and scaled process-time cases. I found no conflicting behavior in the flagged clock-related PRs: #9447 adds a different steady_clock::now_v1_compat export; #9501 handles process CPU clock IDs; #4627 only adjusts Apple tm_zone; #5021/#6879/#7201 concern unrelated native/AOT/WebAssembly timing paths. #6044 moves the test into tests/time/ and conflicts with main, so it will need rebase/coordination before merge; it does not change the test logic. #8979 edits a different libc debt entry, and merge-tree combines both documentation edits without conflict. The PR is two commits behind current main, but currently mergeable.

Checks: the author reports guest_process_time* passing 3/3 runs on Windows 11 with this change and 1,887/1,890 full-suite tests passing (the same three failures were reproduced on main); the currently reported CI jobs pass for conventions, eligibility, intake, labels, report, relinker across Ubuntu/Windows/macOS, ASan, and register-context/write-watch on Ubuntu/macOS. Linux and Windows product build jobs are skipped, and no Linux/macOS or title run is reported. I did not run a local build in this review environment. The PR names four affected title IDs and explains the observed incorrect timing behavior; retain the disassembly-versus-console-measurement qualification in the documentation.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5611602758 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677#pullrequestreview-5611602758). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T08:52:49Z. **Review:** APPROVED --- Reviewed the `clock()` implementation, linkage path, test addition, and reported CI/test results. The change follows the console libc behavior documented from three title library disassemblies, routes through the existing process-time source, and adds a bounded regression assertion in both normal and scaled process-time cases. I found no conflicting behavior in the flagged clock-related PRs: #9447 adds a different `steady_clock::now_v1_compat` export; #9501 handles process CPU clock IDs; #4627 only adjusts Apple `tm_zone`; #5021/#6879/#7201 concern unrelated native/AOT/WebAssembly timing paths. #6044 moves the test into `tests/time/` and conflicts with main, so it will need rebase/coordination before merge; it does not change the test logic. #8979 edits a different libc debt entry, and merge-tree combines both documentation edits without conflict. The PR is two commits behind current main, but currently mergeable. Checks: the author reports `guest_process_time*` passing 3/3 runs on Windows 11 with this change and 1,887/1,890 full-suite tests passing (the same three failures were reproduced on main); the currently reported CI jobs pass for conventions, eligibility, intake, labels, report, relinker across Ubuntu/Windows/macOS, ASan, and register-context/write-watch on Ubuntu/macOS. Linux and Windows product build jobs are skipped, and no Linux/macOS or title run is reported. I did not run a local build in this review environment. The PR names four affected title IDs and explains the observed incorrect timing behavior; retain the disassembly-versus-console-measurement qualification in the documentation.
jotitadev commented 2026-10-22 09:01:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T09:01:43Z.

Review: COMMENTED


First run on Linux (the PR lists Linux as not tested; the non-Windows std::clock branch is the one replaced here). Ubuntu 26.04, glibc 2.43, x86_64 i7-8700, GCC 15.2.0, Release, head 280ae69a4 merged --no-commit onto origin/main 7e2ba73e4.

  • guest_process_time* (4) + patched_libraries: 5/5 pass.
  • Control (GuestTime.hpp, libc Time.cpp and libkernel Time.cpp from main, test from the PR): guest_process_time and guest_process_time_scaled abort with clock() is not the process time; the two _counter tests still pass.
  • Neighbours with the PR: all 26 ^guest_.*(time|clock) tests and guest_kqueue (which times itself with the host std::clock) pass.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5611705890 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677#pullrequestreview-5611705890). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-22T09:01:43Z. **Review:** COMMENTED --- First run on Linux (the PR lists Linux as not tested; the non-Windows `std::clock` branch is the one replaced here). Ubuntu 26.04, glibc 2.43, x86_64 i7-8700, GCC 15.2.0, Release, head 280ae69a4 merged `--no-commit` onto `origin/main` 7e2ba73e4. - `guest_process_time*` (4) + `patched_libraries`: 5/5 pass. - Control (`GuestTime.hpp`, libc `Time.cpp` and libkernel `Time.cpp` from `main`, test from the PR): `guest_process_time` and `guest_process_time_scaled` abort with `clock() is not the process time`; the two `_counter` tests still pass. - Neighbours with the PR: all 26 `^guest_.*(time|clock)` tests and `guest_kqueue` (which times itself with the host `std::clock`) pass. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-22 12:28:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T12:28:38Z.

Review: CHANGES_REQUESTED


The earlier code review remains favorable, and the author-reported Windows and Linux focused test results are noted. This PR is still marked ready, but its checklist says Unblocks: none. Current-main git diff --check is clean; product build/test jobs are skipped by the repository workflow for this PR.

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5614120598 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677#pullrequestreview-5614120598). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T12:28:38Z. **Review:** CHANGES_REQUESTED --- The earlier code review remains favorable, and the author-reported Windows and Linux focused test results are noted. This PR is still marked ready, but its checklist says Unblocks: none. Current-main git diff --check is clean; product build/test jobs are skipped by the repository workflow for this PR. 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.
MarcZX10 commented 2026-10-22 12:28:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T12:28:44Z.

Review: COMMENTED


Correction to my preceding review: I fetched the exact PR head after composing the comment. It is current with upstream/main (0 commits behind, 1 ahead), and git diff --check passes. Please disregard the sentence saying it is 13 commits behind and the request to refresh the branch.

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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5614121717 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677#pullrequestreview-5614121717). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T12:28:44Z. **Review:** COMMENTED --- Correction to my preceding review: I fetched the exact PR head after composing the comment. It is current with upstream/main (0 commits behind, 1 ahead), and git diff --check passes. Please disregard the sentence saying it is 13 commits behind and the request to refresh the branch. 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.
JJenkx commented 2026-10-22 12:29:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T12:29:44Z.


Rebased onto main 8b3a6ba88d (head 3e75fe94d2, no other changes). On Windows (UCRT GCC 15.2, Release), guest_process_time, guest_process_time_counter, guest_process_time_scaled, guest_process_time_counter_scaled and the other libc and time tests (17 tests) pass in three runs out of three. tools/check_conventions.py passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340766908 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677#issuecomment-6340766908). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-22T12:29:44Z. --- Rebased onto `main` 8b3a6ba88d (head 3e75fe94d2, no other changes). On Windows (UCRT GCC 15.2, Release), `guest_process_time`, `guest_process_time_counter`, `guest_process_time_scaled`, `guest_process_time_counter_scaled` and the other libc and time tests (17 tests) pass in three runs out of three. `tools/check_conventions.py` passes.
JJenkx commented 2026-10-22 12:30:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T12:30:00Z.


@MarcZX10 thanks for the correction. I've converted this to a draft under the #5239 hold. It will be marked ready once a title is shown stopping on, or visibly affected by, clock() timing on current main, with that run linked here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340772040 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677#issuecomment-6340772040). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-22T12:30:00Z. --- @MarcZX10 thanks for the correction. I've converted this to a draft under the #5239 hold. It will be marked ready once a title is shown stopping on, or visibly affected by, `clock()` timing on current `main`, with that run linked here.
JJenkx commented 2026-10-22 13:28:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-22T13:28:48Z.


Marked ready for review. This was a draft only because of the #5239 intake hold, which @MarcZX10 has withdrawn (https://github.com/boykopovar/AnyPS5/pull/9613#issuecomment-6337453028 and on #9596).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6341959404 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677#issuecomment-6341959404). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-22T13:28:48Z. --- Marked ready for review. This was a draft only because of the #5239 intake hold, which @MarcZX10 has withdrawn (https://github.com/boykopovar/AnyPS5/pull/9613#issuecomment-6337453028 and on #9596).
MarcZX10 commented 2026-10-22 14:34:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T14:34:38Z.

Review: APPROVED


Correction: my earlier changes-requested review was based on an inaccurate intake and stale-base note. I have verified that note was corrected, and my review found no remaining code blocker. PRs may continue to be submitted and will be handled in due course.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5615929107 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677#pullrequestreview-5615929107). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T14:34:38Z. **Review:** APPROVED --- Correction: my earlier changes-requested review was based on an inaccurate intake and stale-base note. I have verified that note was corrected, and my review found no remaining code blocker. PRs may continue to be submitted and will be handled in due course.
MarcZX10 commented 2026-10-29 09:59:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:59:08Z.

Review: APPROVED


Re-reviewed — approved

The latest refresh preserves the process-time change and the checked pointer behavior from the already-merged #11402 integration. The author reports the Linux focused matrix rebuilt on exact head 6ac7ce9e401899294b07fd56eea0ec72a6fb0980: seven groups, three runs each, 21 passes and no skips. The PR also retains its earlier Windows and title/reference evidence at their original stated pins; no new Windows, console, title, GPU or full-suite run is claimed.

I checked exact head 6ac7ce9e401899294b07fd56eea0ec72a6fb0980 against current main f7e84c4cf1609cc10bac95a44cd431805e5ebc8a:

  • tools/check_conventions.py: passed.
  • git diff --check: passed.
  • Current-main merge preview: clean. The current-main changes in shared paths are adjacent debt text and API declarations; Time.cpp and the process-time tests have no intervening main changes.
  • Hosted relinker, ASan, register-context, write-watch and Windows checks pass; Linux product jobs are skipped by policy.

The Linux runs are author-reported; I did not execute them locally. No blocking issue remains in this exact head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695887024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9677#pullrequestreview-5695887024). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:59:08Z. **Review:** APPROVED --- # Re-reviewed — approved The latest refresh preserves the process-time change and the checked pointer behavior from the already-merged #11402 integration. The author reports the Linux focused matrix rebuilt on exact head `6ac7ce9e401899294b07fd56eea0ec72a6fb0980`: seven groups, three runs each, 21 passes and no skips. The PR also retains its earlier Windows and title/reference evidence at their original stated pins; no new Windows, console, title, GPU or full-suite run is claimed. I checked exact head `6ac7ce9e401899294b07fd56eea0ec72a6fb0980` against current `main` `f7e84c4cf1609cc10bac95a44cd431805e5ebc8a`: - `tools/check_conventions.py`: passed. - `git diff --check`: passed. - Current-main merge preview: clean. The current-main changes in shared paths are adjacent debt text and API declarations; `Time.cpp` and the process-time tests have no intervening main changes. - Hosted relinker, ASan, register-context, write-watch and Windows checks pass; Linux product jobs are skipped by policy. The Linux runs are author-reported; I did not execute them locally. No blocking issue remains in this exact head.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9677
No description provided.