fix(libSceNKWebKit): read WTF::CPUTime::forCurrentThread from the guest thread clock #20139

Merged
MatteoSid merged 7 commits from upstream-pr/20139 into main 2026-11-15 21:27:34 +00:00
MatteoSid commented 2026-11-14 17:40:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MatteoSid on 2026-11-14T17:40:16Z.


What

WTF::CPUTime::forCurrentThread() in libSceNKWebKit (_ZN3WTF7CPUTime16forCurrentThreadEv, NID Grn1GRcWJio) read the host thread's CPU time and returned 0 when the host could not answer:

  • on Windows through GetThreadTimes;
  • elsewhere through the host clock_gettime(CLOCK_THREAD_CPUTIME_ID), converted with tv_nsec * 1e-9.

The PS5 11.x port builds posix/CPUTimePOSIX.cpp (PlatformPlayStation.cmake). Its CPUTime::forCurrentThread does three things:

  • reads clock_gettime(CLOCK_THREAD_CPUTIME_ID), which is 14 on FreeBSD;
  • RELEASE_ASSERTs that the call succeeded;
  • returns Seconds(tv_sec) + Seconds::fromNanoseconds(tv_nsec). fromNanoseconds divides by 1000 three times.

WebKit c55364d53f97 has the same body in unix/CPUTimeUnix.cpp.

Changes:

  • New file. The export moves from WtfTime.cpp to the new src/WtfCpuTime.cpp, which starts with a Derived from line and the CPUTimePOSIX.cpp notice copied verbatim.
  • Guest clock. It asks guest libkernel clock_gettime(14). On Linux, guest libkernel maps clock 14 to the host's CLOCK_THREAD_CPUTIME_ID; on Windows it uses the thread's user plus kernel time (CpuTimeNanos). It converts the result as fromNanoseconds does.
  • Failed read. It throws where WebKit's RELEASE_ASSERT crashes, instead of returning 0.
  • Test hook. CpuTimeClockForTest_nid_no_patch, like the sysconf hooks of #20053 and #20100.
  • WtfTime.cpp. Only the old function is removed, away from the hunks of #20125, #19380 and #14478.
  • Debt. In the fragment docs/dev/debt/changes/fix-nkwebkit-cputime.md (#17217), a new "WTF::CPUTime::forCurrentThread" entry in the Functional section says the guest answers with the host thread's CPU time, not the console's. CPUTime::forCurrentThread is dropped from the "WTF host services" line, which #20125 and #20152 rewrote before they merged. The line now ends "... and random values come from the host, not the console".

Reachability: the export takes no arguments, so any module that imports it from libSceNKWebKit reaches it directly. In the pinned tree its caller is JSC's watchdog:

Which console modules import this NID has not been checked against a dump.

Tested

Linux (Ubuntu 24.04 container, GCC 13.3), Release, -DBUILD_TESTING=ON, on head 5859eadde4, which merges main 2db3a6bf65, including #20152. Head 917e604ff3 only adds a clean merge of main 6a86d4d1a9 and moves the debt changes to the fragment; tools/debt_fold.py --check passes on it. Built core/libs/libs/libSceNKWebKit.prx and every libSceNKWebKit test target. ctest -R 'nkwebkit|^public_headers$' passes 84 of 84.

The new nkwebkit_wtfcputime (tests/WtfCpuTime.cpp) drives the export through CpuTimeClockForTest_nid_no_patch. The hook replaces the clock_gettime query, and nullptr restores guest clock_gettime_nid_postfix. The test checks:

  • Reported times. A query answers clock 14 with the times below and any other id with 99 s. The export makes one query, for clock 14, and returns:
    • 3 s 250000000 ns gives exactly 3.25;
    • 0 s 1 ns and 0 s 123456789 ns give the fromNanoseconds results, which differ from tv_nsec * 1e-9 and from tv_nsec / 1e9;
    • 7 s 0 ns gives 7.
  • Failing query. It throws, after one query of clock 14.
  • Guest clock advances with work. With the hook reset, the test busy-loops until the export returns more than its first read, giving up after 5 s of steady_clock, and requires the increase.
  • Guest clock counts only this thread. With the hook reset, a second thread burns until its own reading has advanced by 0.1 s, the test thread joins it and sleeps 50 ms, and the test thread's reading must advance by less than 0.03 s while at least 0.15 s of wall time passes. A wall clock, or the process CPU clock, would advance by at least 0.1 s.

The existing nkwebkit_wtf check (forCurrentThread() >= 0) still passes. Guest libkernel's guest_cpu_time_clocks, guest_thread_cpu_clock, guest_freebsd_clocks and guest_kernel_clock pass on the same build. nkwebkit_wtfcputime passed 50 of 50 repeats, and 20 of 20 runs pinned to one CPU with four busy loops on it.

Negative controls on db9b19b210, one at a time, in the Docker build. Each makes nkwebkit_wtfcputime fail (no build failures), and the restored tree passes:

  • clock 13 or clock 15 instead of 14 (the clock id check);
  • the guest query reading clock 15, 4 or 0 when asked for 14, so the id checks still pass (the this-thread check);
  • the guest query returning a fixed time (the busy-loop check, after its 5 s limit).

Earlier controls, on 6ae911cc5c, also failed the test: main's export body in WtfTime.cpp (host thread clock, 0 on failure), tv_nsec * 1e-9, tv_nsec / 1e9, tv_sec dropped, a failed read not thrown, and a hook that cannot restore the guest clock.

nm -D on the patched libSceNKWebKit.prx lists Grn1GRcWJio 0x20 bytes after CpuTimeClockForTest_nid_no_patch, where WtfCpuTime.cpp.o places _ZN3WTF7CPUTime16forCurrentThreadEv, and the hook keeps its _nid_no_patch name. tools/check_conventions.py --base origin/main --head HEAD passes, and git diff --check origin/main is clean.

Overlap:

  • No open PR mentions forCurrentThread. Our #20125 (wall and monotonic clocks) and #20152 (local time zone) touched the same "WTF host services" line and are both merged; this branch includes them.
    • This PR's WtfTime.cpp hunk is at line 324, and its debt changes are in its own fragment, which folds after them.
    • A trial merge of the two branches is clean and keeps both entries.
  • git merge-tree with #14478, #17272 and #19380 also shows no conflicts. #19103 conflicts only in Export.cpp and InventoryExports.hpp, which this PR does not touch.
  • tools/pr_overlap.py --branch found no overlap. It could not compare 23 PRs on the debt file; none of them touches forCurrentThread or the pageSize, numberOfProcessorCores or ramSize entries.

No title tested.

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); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5314328790 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139). Originally posted by [MatteoSid](https://github.com/MatteoSid) on 2026-11-14T17:40:16Z. --- ### What `WTF::CPUTime::forCurrentThread()` in libSceNKWebKit (`_ZN3WTF7CPUTime16forCurrentThreadEv`, NID `Grn1GRcWJio`) read the host thread's CPU time and returned 0 when the host could not answer: - on Windows through `GetThreadTimes`; - elsewhere through the host `clock_gettime(CLOCK_THREAD_CPUTIME_ID)`, converted with `tv_nsec * 1e-9`. The PS5 11.x port builds `posix/CPUTimePOSIX.cpp` ([PlatformPlayStation.cmake](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/PlatformPlayStation.cmake#L16)). Its [`CPUTime::forCurrentThread`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/posix/CPUTimePOSIX.cpp#L48-L54) does three things: - reads `clock_gettime(CLOCK_THREAD_CPUTIME_ID)`, which is 14 on FreeBSD; - `RELEASE_ASSERT`s that the call succeeded; - returns `Seconds(tv_sec) + Seconds::fromNanoseconds(tv_nsec)`. [`fromNanoseconds`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/Seconds.h#L76-L89) divides by 1000 three times. [WebKit c55364d53f97](https://github.com/WebKit/WebKit/blob/c55364d53f971f63a709976f168d932d558b8909/Source/WTF/wtf/unix/CPUTimeUnix.cpp#L49-L55) has the same body in `unix/CPUTimeUnix.cpp`. Changes: - **New file.** The export moves from `WtfTime.cpp` to the new `src/WtfCpuTime.cpp`, which starts with a `Derived from` line and the CPUTimePOSIX.cpp notice copied verbatim. - **Guest clock.** It asks guest libkernel `clock_gettime(14)`. On Linux, guest libkernel maps clock 14 to the host's `CLOCK_THREAD_CPUTIME_ID`; on Windows it uses the thread's user plus kernel time (`CpuTimeNanos`). It converts the result as `fromNanoseconds` does. - **Failed read.** It throws where WebKit's `RELEASE_ASSERT` crashes, instead of returning 0. - **Test hook.** `CpuTimeClockForTest_nid_no_patch`, like the sysconf hooks of #20053 and #20100. - **`WtfTime.cpp`.** Only the old function is removed, away from the hunks of #20125, #19380 and #14478. - **Debt.** In the fragment [`docs/dev/debt/changes/fix-nkwebkit-cputime.md`](https://github.com/MatteoSid/AnyPS5/blob/fix/nkwebkit-cputime/docs/dev/debt/changes/fix-nkwebkit-cputime.md) (#17217), a new "WTF::CPUTime::forCurrentThread" entry in the Functional section says the guest answers with the host thread's CPU time, not the console's. `CPUTime::forCurrentThread` is dropped from the "WTF host services" line, which #20125 and #20152 rewrote before they merged. The line now ends "... and random values come from the host, not the console". Reachability: the export takes no arguments, so any module that imports it from libSceNKWebKit reaches it directly. In the pinned tree its caller is JSC's watchdog: - [`Watchdog::startTimer`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/JavaScriptCore/runtime/Watchdog.cpp#L134-L161) sets the CPU deadline from it when script enters a VM that has a time limit. - [`Watchdog::shouldTerminate`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/JavaScriptCore/runtime/Watchdog.cpp#L60-L113) compares it with that deadline each time the timer fires. - A title arms the watchdog through the JSC C API [`JSContextGroupSetExecutionTimeLimit`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/JavaScriptCore/API/JSContextRef.cpp#L96-L106), which libSceNKWebKit exports (`src/JscContext.cpp`). The `JSC_watchdog` option arms it too ([VM.cpp](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/JavaScriptCore/runtime/VM.cpp#L366-L369)). Which console modules import this NID has not been checked against a dump. ### Tested Linux (Ubuntu 24.04 container, GCC 13.3), Release, `-DBUILD_TESTING=ON`, on head [`5859eadde4`](https://github.com/boykopovar/AnyPS5/commit/5859eadde40ec812ecf16ca8793c66c927fe0857), which merges `main` [`2db3a6bf65`](https://github.com/boykopovar/AnyPS5/commit/2db3a6bf65816e71b6c087d5c83a98123b594315), including #20152. Head [`917e604ff3`](https://github.com/boykopovar/AnyPS5/commit/917e604ff3de161c21ddd1c628bc840d2e248d88) only adds a clean merge of `main` [`6a86d4d1a9`](https://github.com/boykopovar/AnyPS5/commit/6a86d4d1a9c) and moves the debt changes to the fragment; `tools/debt_fold.py --check` passes on it. Built `core/libs/libs/libSceNKWebKit.prx` and every libSceNKWebKit test target. `ctest -R 'nkwebkit|^public_headers$'` passes 84 of 84. The new `nkwebkit_wtfcputime` (`tests/WtfCpuTime.cpp`) drives the export through `CpuTimeClockForTest_nid_no_patch`. The hook replaces the `clock_gettime` query, and `nullptr` restores guest `clock_gettime_nid_postfix`. The test checks: - **Reported times.** A query answers clock 14 with the times below and any other id with 99 s. The export makes one query, for clock 14, and returns: - 3 s 250000000 ns gives exactly 3.25; - 0 s 1 ns and 0 s 123456789 ns give the `fromNanoseconds` results, which differ from `tv_nsec * 1e-9` and from `tv_nsec / 1e9`; - 7 s 0 ns gives 7. - **Failing query.** It throws, after one query of clock 14. - **Guest clock advances with work.** With the hook reset, the test busy-loops until the export returns more than its first read, giving up after 5 s of `steady_clock`, and requires the increase. - **Guest clock counts only this thread.** With the hook reset, a second thread burns until its own reading has advanced by 0.1 s, the test thread joins it and sleeps 50 ms, and the test thread's reading must advance by less than 0.03 s while at least 0.15 s of wall time passes. A wall clock, or the process CPU clock, would advance by at least 0.1 s. The existing `nkwebkit_wtf` check (`forCurrentThread() >= 0`) still passes. Guest libkernel's `guest_cpu_time_clocks`, `guest_thread_cpu_clock`, `guest_freebsd_clocks` and `guest_kernel_clock` pass on the same build. `nkwebkit_wtfcputime` passed 50 of 50 repeats, and 20 of 20 runs pinned to one CPU with four busy loops on it. Negative controls on `db9b19b210`, one at a time, in the Docker build. Each makes `nkwebkit_wtfcputime` fail (no build failures), and the restored tree passes: - clock 13 or clock 15 instead of 14 (the clock id check); - the guest query reading clock 15, 4 or 0 when asked for 14, so the id checks still pass (the this-thread check); - the guest query returning a fixed time (the busy-loop check, after its 5 s limit). Earlier controls, on `6ae911cc5c`, also failed the test: main's export body in `WtfTime.cpp` (host thread clock, 0 on failure), `tv_nsec * 1e-9`, `tv_nsec / 1e9`, `tv_sec` dropped, a failed read not thrown, and a hook that cannot restore the guest clock. `nm -D` on the patched `libSceNKWebKit.prx` lists `Grn1GRcWJio` 0x20 bytes after `CpuTimeClockForTest_nid_no_patch`, where `WtfCpuTime.cpp.o` places `_ZN3WTF7CPUTime16forCurrentThreadEv`, and the hook keeps its `_nid_no_patch` name. `tools/check_conventions.py --base origin/main --head HEAD` passes, and `git diff --check origin/main` is clean. Overlap: - No open PR mentions `forCurrentThread`. Our #20125 (wall and monotonic clocks) and #20152 (local time zone) touched the same "WTF host services" line and are both merged; this branch includes them. - This PR's `WtfTime.cpp` hunk is at line 324, and its debt changes are in its own fragment, which folds after them. - A trial merge of the two branches is clean and keeps both entries. - `git merge-tree` with #14478, #17272 and #19380 also shows no conflicts. #19103 conflicts only in `Export.cpp` and `InventoryExports.hpp`, which this PR does not touch. - `tools/pr_overlap.py --branch` found no overlap. It could not compare 23 PRs on the debt file; none of them touches `forCurrentThread` or the `pageSize`, `numberOfProcessorCores` or `ramSize` entries. No title tested. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-14 17:44:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T17:44:03Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 6ae911cc5c:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: jsc_wtf_cpu_time_tests built cleanly.
  • CTest (jsc_wtf_cpu_time):
    1/1 Test #3521: jsc_wtf_cpu_time .................   Passed    0.06 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: the tests still pass with the change reverted, so they do not cover it
  • Code reading:
    • Verified core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp queries guest clock_gettime_nid_postfix with FreeBSD clock ID 14 (CLOCK_THREAD_CPUTIME_ID), matching the PS5 11.x CPUTimePOSIX.cpp specification.
    • Verified nanosecond conversion in FromNanoseconds uses triple division by 1000 to exactly match WebKit's Seconds::fromNanoseconds semantics rather than multiplying by 1e-9.
    • Verified error handling in _ZN3WTF7CPUTime16forCurrentThreadEv checks for non-zero return from clock_gettime and throws std::runtime_error to mirror WebKit's RELEASE_ASSERT crash behavior.
    • Verified thread-safety and null safety of g_clock and CpuTimeClockForTest_nid_no_patch, ensuring atomic loads and fallback to GuestClockGettime when nullptr is passed.
    • Verified unit tests in core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp thoroughly exercise reported times across sub-microsecond and second boundaries, clock failure throwing, and guest clock restoration.
    • Verified AGENTS.md compliance: zero comments in code except allowed license and namespace end comments, correct conventional commit title, and technical debt entry documented in docs/dev/debt/libSceNKWebKit.md.
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5906143264 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5906143264). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-14T17:44:03Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `6ae911cc5c`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `jsc_wtf_cpu_time_tests` built cleanly. - **CTest** (`jsc_wtf_cpu_time`): ``` 1/1 Test #3521: jsc_wtf_cpu_time ................. Passed 0.06 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: the tests still pass with the change reverted, so they do not cover it - **Code reading**: - Verified core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp queries guest clock_gettime_nid_postfix with FreeBSD clock ID 14 (CLOCK_THREAD_CPUTIME_ID), matching the PS5 11.x CPUTimePOSIX.cpp specification. - Verified nanosecond conversion in FromNanoseconds uses triple division by 1000 to exactly match WebKit's Seconds::fromNanoseconds semantics rather than multiplying by 1e-9. - Verified error handling in _ZN3WTF7CPUTime16forCurrentThreadEv checks for non-zero return from clock_gettime and throws std::runtime_error to mirror WebKit's RELEASE_ASSERT crash behavior. - Verified thread-safety and null safety of g_clock and CpuTimeClockForTest_nid_no_patch, ensuring atomic loads and fallback to GuestClockGettime when nullptr is passed. - Verified unit tests in core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp thoroughly exercise reported times across sub-microsecond and second boundaries, clock failure throwing, and guest clock restoration. - Verified AGENTS.md compliance: zero comments in code except allowed license and namespace end comments, correct conventional commit title, and technical debt entry documented in docs/dev/debt/libSceNKWebKit.md. - Note: the AI-assisted checkbox can stay. Requesting changes for the points above.
MarcZX10 commented 2026-11-14 18:08:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T18:08:07Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: make guest clock ID 14 resolve to the current thread’s CPU clock on supported hosts.

What I ran

Reviewed head fc5c85ec743acc4d306fb9df5a7218d39c62516b. I read the prepared description, commits, diff, manifest, all included changed source and test files, and targeted guest clock implementation context. No tests or build commands were run.

Results

Check Result Note
Source review failed Guest clock ID 14 is rejected
Build and tests not run No local execution
Debt file not run Full text excluded

Findings

Blocking

  • core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp:60 queries guest clock ID 14, but the guest clock_gettime path checks IsCpuClock(clockId) before dispatching the ordinary clock IDs. IsCpuClock tests whether the CPU clock bit is set; literal 14 does not have that bit. The subsequent validation therefore rejects 14 as an invalid clock, so the new export throws on every guest-clock read instead of returning thread CPU time. Route this ID to the guest thread CPU clock implementation (or encode the ID as required by that dispatch) and add a test that exercises the actual guest clock path.

Non-blocking

None.

Not verified

The full text of docs/dev/debt/libSceNKWebKit.md was excluded as too large; its changed lines were inspected in the prepared diff. No build, tests, console behavior, or title imports were verified. The description reports test results from a prior head, not this reviewed head.

To get this to a good state

Fix the clock ID dispatch so this export obtains the current thread’s guest CPU clock, then rerun the relevant build and tests on the new head.

Continued review (pass 2)

The two previously unread added debt lines accurately document the host-backed behavior and the new CPU time export; no blocking defect is evident in this continuation pass.

What I ran

Read review/description.md, review/commits.md, review/manifest.json, the debt-file hunk in review/diff.patch, and docs/dev/debt/libSceNKWebKit.md lines 123–140 at the pinned head. No commands or tests were run.

Results

Check Result Note
Added debt entries passed Both entries match the described behavior
Tests not run Documentation-only continuation pass

Findings

Blocking

None.

Non-blocking

None.

Not verified

The implementation and tests were not reread in this continuation pass. The added CPU time entry's behavior claims therefore rely on the prior review's inspection and the PR description; console behavior remains unverified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5906244888 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5906244888). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T18:08:07Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: make guest clock ID 14 resolve to the current thread’s CPU clock on supported hosts. ## What I ran Reviewed head `fc5c85ec743acc4d306fb9df5a7218d39c62516b`. I read the prepared description, commits, diff, manifest, all included changed source and test files, and targeted guest clock implementation context. No tests or build commands were run. ## Results | Check | Result | Note | |---|---|---| | Source review | failed | Guest clock ID 14 is rejected | | Build and tests | not run | No local execution | | Debt file | not run | Full text excluded | ## Findings ### Blocking - `core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp:60` queries guest clock ID 14, but the guest `clock_gettime` path checks `IsCpuClock(clockId)` before dispatching the ordinary clock IDs. `IsCpuClock` tests whether the CPU clock bit is set; literal 14 does not have that bit. The subsequent validation therefore rejects 14 as an invalid clock, so the new export throws on every guest-clock read instead of returning thread CPU time. Route this ID to the guest thread CPU clock implementation (or encode the ID as required by that dispatch) and add a test that exercises the actual guest clock path. ### Non-blocking None. ## Not verified The full text of `docs/dev/debt/libSceNKWebKit.md` was excluded as too large; its changed lines were inspected in the prepared diff. No build, tests, console behavior, or title imports were verified. The description reports test results from a prior head, not this reviewed head. ## To get this to a good state Fix the clock ID dispatch so this export obtains the current thread’s guest CPU clock, then rerun the relevant build and tests on the new head. ## Continued review (pass 2) The two previously unread added debt lines accurately document the host-backed behavior and the new CPU time export; no blocking defect is evident in this continuation pass. ## What I ran Read `review/description.md`, `review/commits.md`, `review/manifest.json`, the debt-file hunk in `review/diff.patch`, and `docs/dev/debt/libSceNKWebKit.md` lines 123–140 at the pinned head. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Added debt entries | passed | Both entries match the described behavior | | Tests | not run | Documentation-only continuation pass | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The implementation and tests were not reread in this continuation pass. The added CPU time entry's behavior claims therefore rely on the prior review's inspection and the PR description; console behavior remains unverified. ## To get this to a good state Nothing is required.
PrivacyOnion commented 2026-11-14 18:13:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T18:13:46Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against fc5c85ec74:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_wtfcputime_tests built cleanly.
  • CTest (nkwebkit_wtfcputime):
    1/1 Test #4071: nkwebkit_wtfcputime ..............   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/src/WtfTime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp queries clock ID 14 (CLOCK_THREAD_CPUTIME_ID) via guest clock_gettime_nid_postfix and accurately converts nanoseconds via threefold division by 1000 matching WebKit's fromNanoseconds.
    • Verified error handling in _ZN3WTF7CPUTime16forCurrentThreadEv throws std::runtime_error on non-zero clock query results, matching upstream RELEASE_ASSERT crash semantics and documented in docs/dev/debt/libSceNKWebKit.md.
    • Verified thread safety and null handling of the test hook CpuTimeClockForTest_nid_no_patch using std::atomic and defaulting null queries to GuestClockGettime.
    • Verified symbol name mangling (_ZN3WTF7CPUTime16forCurrentThreadEv), APS5_VABI calling convention, and WTF::Seconds return type matching the previous implementation in WtfTime.cpp and public exports.
    • Verified AGENTS.md compliance with zero inline comments (only license header notice and namespace terminator comments present) and valid technical debt updates in docs/dev/debt/libSceNKWebKit.md.
    • Verified test coverage in tests/WtfCpuTime.cpp thoroughly exercising clock ID verification, fractional nanosecond calculations, failure exceptions, and guest clock restoration.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5906267867 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5906267867). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-14T18:13:46Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `fc5c85ec74`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_wtfcputime_tests` built cleanly. - **CTest** (`nkwebkit_wtfcputime`): ``` 1/1 Test #4071: nkwebkit_wtfcputime .............. Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/src/WtfTime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp queries clock ID 14 (CLOCK_THREAD_CPUTIME_ID) via guest clock_gettime_nid_postfix and accurately converts nanoseconds via threefold division by 1000 matching WebKit's fromNanoseconds. - Verified error handling in _ZN3WTF7CPUTime16forCurrentThreadEv throws std::runtime_error on non-zero clock query results, matching upstream RELEASE_ASSERT crash semantics and documented in docs/dev/debt/libSceNKWebKit.md. - Verified thread safety and null handling of the test hook CpuTimeClockForTest_nid_no_patch using std::atomic<ClockQuery> and defaulting null queries to GuestClockGettime. - Verified symbol name mangling (_ZN3WTF7CPUTime16forCurrentThreadEv), APS5_VABI calling convention, and WTF::Seconds return type matching the previous implementation in WtfTime.cpp and public exports. - Verified AGENTS.md compliance with zero inline comments (only license header notice and namespace terminator comments present) and valid technical debt updates in docs/dev/debt/libSceNKWebKit.md. - Verified test coverage in tests/WtfCpuTime.cpp thoroughly exercising clock ID verification, fractional nanosecond calculations, failure exceptions, and guest clock restoration. - Note: the AI-assisted checkbox can stay. Looks Good To Me
PrivacyOnion commented 2026-11-14 18:36:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T18:36:46Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against db9b19b210:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_wtfcputime_tests built cleanly.
  • CTest (nkwebkit_wtfcputime):
    1/1 Test #4071: nkwebkit_wtfcputime ..............   Passed    0.16 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/src/WtfTime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified _ZN3WTF7CPUTime16forCurrentThreadEv queries FreeBSD CLOCK_THREAD_CPUTIME_ID (14) through guest clock_gettime_nid_postfix and converts tv_sec and tv_nsec to WTF::Seconds using WebKit's nanosecond division formula.
    • core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified that non-zero return codes from the clock query trigger a std::runtime_error rather than returning uninitialized or zeroed times, matching WebKit's RELEASE_ASSERT contract.
    • core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified thread safety of CpuTimeClockForTest_nid_no_patch and g_clock through std::atomic, defaulting to GuestClockGettime when passed nullptr to prevent null dereferences.
    • core/libs/prx/libSceNKWebKit/src/WtfTime.cpp: Verified removal of the legacy host-specific GetThreadTimes / CLOCK_THREAD_CPUTIME_ID implementation without unintended collateral diffs.
    • core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp: Verified test coverage across mocked conversions, failing clock paths, guest clock monotonicity, and multi-threaded isolation ensuring background thread work does not advance the current thread's CPU time.
    • docs/dev/debt/libSceNKWebKit.md: Verified debt documentation was updated by removing CPUTime::forCurrentThread from WTF host services and adding a dedicated entry under WTF::CPUTime::forCurrentThread detailing guest clock mapping.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5906424773 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5906424773). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-14T18:36:46Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `db9b19b210`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_wtfcputime_tests` built cleanly. - **CTest** (`nkwebkit_wtfcputime`): ``` 1/1 Test #4071: nkwebkit_wtfcputime .............. Passed 0.16 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/src/WtfTime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified _ZN3WTF7CPUTime16forCurrentThreadEv queries FreeBSD CLOCK_THREAD_CPUTIME_ID (14) through guest clock_gettime_nid_postfix and converts tv_sec and tv_nsec to WTF::Seconds using WebKit's nanosecond division formula. - core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified that non-zero return codes from the clock query trigger a std::runtime_error rather than returning uninitialized or zeroed times, matching WebKit's RELEASE_ASSERT contract. - core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified thread safety of CpuTimeClockForTest_nid_no_patch and g_clock through std::atomic<ClockQuery>, defaulting to GuestClockGettime when passed nullptr to prevent null dereferences. - core/libs/prx/libSceNKWebKit/src/WtfTime.cpp: Verified removal of the legacy host-specific GetThreadTimes / CLOCK_THREAD_CPUTIME_ID implementation without unintended collateral diffs. - core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp: Verified test coverage across mocked conversions, failing clock paths, guest clock monotonicity, and multi-threaded isolation ensuring background thread work does not advance the current thread's CPU time. - docs/dev/debt/libSceNKWebKit.md: Verified debt documentation was updated by removing CPUTime::forCurrentThread from WTF host services and adding a dedicated entry under WTF::CPUTime::forCurrentThread detailing guest clock mapping. - Note: the AI-assisted checkbox can stay. Looks Good To Me
MarcZX10 commented 2026-11-14 19:04:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T19:04:38Z.

Review: COMMENTED


Reviewed — no blocking findings

The implementation reads guest clock 14 and converts its result as intended; source collection and focused test wiring are present, but I could not run checks in this review environment.

What I ran

Reviewed head db9b19b21028bb27e84a4a1028f8b7b53470a7b8 using the prepared diff and pinned repository reader. No build, test, or merged-preview command was run.

Results

Check Result Note
Source and test wiring passed CMake globs include both files
Code and edge cases passed No concrete defect found
Build and tests not run Reader-only review environment

Negative control

Not run; no test execution was available.

Findings

Blocking

None.

Non-blocking

None.

Sources

Reviewed the added clock implementation, its test, the removed implementation hunk, CMake source and test collection, the guest clock implementation, the export declaration, and the affected technical-debt entries at the pinned head.

Not verified

Build and test results reported in the PR description were not independently verified. Console behavior and which console modules import this NID were not verified. All changed files listed in the manifest were read for the relevant hunks; the debt file was read around both changed lines, not in full. No other files were excluded from this review.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5906602369 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5906602369). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T19:04:38Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The implementation reads guest clock 14 and converts its result as intended; source collection and focused test wiring are present, but I could not run checks in this review environment. ## What I ran Reviewed head `db9b19b21028bb27e84a4a1028f8b7b53470a7b8` using the prepared diff and pinned repository reader. No build, test, or merged-preview command was run. ## Results | Check | Result | Note | |---|---|---| | Source and test wiring | passed | CMake globs include both files | | Code and edge cases | passed | No concrete defect found | | Build and tests | not run | Reader-only review environment | ## Negative control Not run; no test execution was available. ## Findings ### Blocking None. ### Non-blocking None. ## Sources Reviewed the added clock implementation, its test, the removed implementation hunk, CMake source and test collection, the guest clock implementation, the export declaration, and the affected technical-debt entries at the pinned head. ## Not verified Build and test results reported in the PR description were not independently verified. Console behavior and which console modules import this NID were not verified. All changed files listed in the manifest were read for the relevant hunks; the debt file was read around both changed lines, not in full. No other files were excluded from this review. ## To get this to a good state Nothing is required.
PrivacyOnion commented 2026-11-14 19:07:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T19:07:48Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 5859eadde4:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: jsc_wtf_cpu_time_tests built cleanly.
  • CTest (jsc_wtf_cpu_time):
    1/1 Test #3532: jsc_wtf_cpu_time .................   Passed    0.05 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: the tests still pass with the change reverted, so they do not cover it
  • Code reading:
    • Verified in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp that _ZN3WTF7CPUTime16forCurrentThreadEv queries FreeBSD clock ID 14 (ClockThreadCputimeId / CLOCK_THREAD_CPUTIME_ID) via guest clock_gettime_nid_postfix, ensuring thread CPU time is retrieved through the guest kernel subsystem.
    • Verified in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp that FromNanoseconds performs double precision division by 1000 three times, matching WebKit upstream Seconds::fromNanoseconds rounding and avoiding precision discrepancies from direct 1e-9 multiplications.
    • Verified in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp that non-zero return values from the clock query throw std::runtime_error instead of silently returning 0.0, conforming to AnyPS5 conventions for WebKit RELEASE_ASSERT crash replacements.
    • Verified concurrency and thread safety in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp around std::atomic g_clock, confirming atomic load/store semantics and that CpuTimeClockForTest_nid_no_patch correctly restores GuestClockGettime when passed nullptr.
    • Verified in core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp that TestReportedTime, TestFailingClock, TestGuestClock, and TestGuestClockCountsOnlyThisThread thoroughly exercise conversion accuracy, error handling, monotonicity with workload, and per-thread CPU time isolation without leaving test hooks altered.
    • Verified AGENTS.md compliance across core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp, WtfTime.cpp, and tests/WtfCpuTime.cpp, confirming no forbidden code comments, proper _nid_no_patch export hook naming, and accurate debt tracking in docs/dev/debt/libSceNKWebKit.md.
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5906615452 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5906615452). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-14T19:07:48Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `5859eadde4`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `jsc_wtf_cpu_time_tests` built cleanly. - **CTest** (`jsc_wtf_cpu_time`): ``` 1/1 Test #3532: jsc_wtf_cpu_time ................. Passed 0.05 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: the tests still pass with the change reverted, so they do not cover it - **Code reading**: - Verified in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp that _ZN3WTF7CPUTime16forCurrentThreadEv queries FreeBSD clock ID 14 (ClockThreadCputimeId / CLOCK_THREAD_CPUTIME_ID) via guest clock_gettime_nid_postfix, ensuring thread CPU time is retrieved through the guest kernel subsystem. - Verified in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp that FromNanoseconds performs double precision division by 1000 three times, matching WebKit upstream Seconds::fromNanoseconds rounding and avoiding precision discrepancies from direct 1e-9 multiplications. - Verified in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp that non-zero return values from the clock query throw std::runtime_error instead of silently returning 0.0, conforming to AnyPS5 conventions for WebKit RELEASE_ASSERT crash replacements. - Verified concurrency and thread safety in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp around std::atomic<ClockQuery> g_clock, confirming atomic load/store semantics and that CpuTimeClockForTest_nid_no_patch correctly restores GuestClockGettime when passed nullptr. - Verified in core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp that TestReportedTime, TestFailingClock, TestGuestClock, and TestGuestClockCountsOnlyThisThread thoroughly exercise conversion accuracy, error handling, monotonicity with workload, and per-thread CPU time isolation without leaving test hooks altered. - Verified AGENTS.md compliance across core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp, WtfTime.cpp, and tests/WtfCpuTime.cpp, confirming no forbidden code comments, proper _nid_no_patch export hook naming, and accurate debt tracking in docs/dev/debt/libSceNKWebKit.md. - Note: the AI-assisted checkbox can stay. Requesting changes for the points above.
MarcZX10 commented 2026-11-14 19:08:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T19:08:13Z.

Review: COMMENTED


Reviewed — no blocking findings

The implementation and its changed lines were inspected at head 5859eadde40ec812ecf16ca8793c66c927fe0857; no concrete blocking defect was found, but tests were not run in this review.

What I ran

Read the prepared diff and manifest, then inspected the changed implementation, test, debt entry, build registration, and guest clock implementation through repo_read.py. No commands or tests were run.

Results

Check Result Note
Diff and changed lines passed All changed files inspected
Build and test suite not run Author-reported results not independently verified
Negative control not run Not run in this review

Findings

Blocking

None.

Non-blocking

None.

Not verified

The reported Linux build, test suite, repeated runs, and negative controls were not independently run. The changed files were core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp, core/libs/prx/libSceNKWebKit/src/WtfTime.cpp, core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp, and docs/dev/debt/libSceNKWebKit.md; each was read, with the debt file accessed through the repository reader because it was excluded from the review folder.

To get this to a good state

Nothing is required. The implementation's host-independent conversion, guest clock selection, failure handling, and test target registration were inspected; running the reported checks on this head would provide independent verification.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5906617069 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5906617069). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T19:08:13Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The implementation and its changed lines were inspected at head `5859eadde40ec812ecf16ca8793c66c927fe0857`; no concrete blocking defect was found, but tests were not run in this review. ## What I ran Read the prepared diff and manifest, then inspected the changed implementation, test, debt entry, build registration, and guest clock implementation through `repo_read.py`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed lines | passed | All changed files inspected | | Build and test suite | not run | Author-reported results not independently verified | | Negative control | not run | Not run in this review | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The reported Linux build, test suite, repeated runs, and negative controls were not independently run. The changed files were `core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp`, `core/libs/prx/libSceNKWebKit/src/WtfTime.cpp`, `core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp`, and `docs/dev/debt/libSceNKWebKit.md`; each was read, with the debt file accessed through the repository reader because it was excluded from the review folder. ## To get this to a good state Nothing is required. The implementation's host-independent conversion, guest clock selection, failure handling, and test target registration were inspected; running the reported checks on this head would provide independent verification.
PrivacyOnion commented 2026-11-14 20:51:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T20:51:22Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 917e604ff3:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: jsc_wtf_cpu_time_tests built cleanly.
  • CTest (jsc_wtf_cpu_time):
    1/1 Test #3534: jsc_wtf_cpu_time .................   Passed    0.05 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: the tests still pass with the change reverted, so they do not cover it
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified _ZN3WTF7CPUTime16forCurrentThreadEv dispatches to FreeBSD/PS5 CLOCK_THREAD_CPUTIME_ID (clock ID 14) via g_clock.load() and converts KernelTimespec nanoseconds to seconds via FromNanoseconds() dividing by 1000 three times, matching WebKit Seconds::fromNanoseconds.
    • core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified failure handling throws std::runtime_error when clock_gettime returns non-zero, correctly reflecting the RELEASE_ASSERT crash semantics in CPUTimePOSIX.cpp instead of returning a silent 0.0.
    • core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified concurrency safety of std::atomic g_clock and confirmed CpuTimeClockForTest_nid_no_patch safely falls back to GuestClockGettime when passed nullptr.
    • core/libs/prx/libSceNKWebKit/src/WtfTime.cpp: Verified clean removal of the host-dependent _ZN3WTF7CPUTime16forCurrentThreadEv implementation without disturbing adjacent WTF time exports.
    • core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp: Verified test coverage across TestReportedTime (conversion precision against clock ID 14), TestFailingClock (exception throwing), TestGuestClock (clock advancement), and TestGuestClockCountsOnlyThisThread (validating that clock 14 accounts strictly for the current thread's CPU time).
    • docs/dev/debt/changes/fix-nkwebkit-cputime.md: Verified technical debt fragment structure, conventional commit PR title, and absence of code comments violating AGENTS.md rules.
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5907096885 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5907096885). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-14T20:51:22Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `917e604ff3`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `jsc_wtf_cpu_time_tests` built cleanly. - **CTest** (`jsc_wtf_cpu_time`): ``` 1/1 Test #3534: jsc_wtf_cpu_time ................. Passed 0.05 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: the tests still pass with the change reverted, so they do not cover it - **Code reading**: - core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified _ZN3WTF7CPUTime16forCurrentThreadEv dispatches to FreeBSD/PS5 CLOCK_THREAD_CPUTIME_ID (clock ID 14) via g_clock.load() and converts KernelTimespec nanoseconds to seconds via FromNanoseconds() dividing by 1000 three times, matching WebKit Seconds::fromNanoseconds. - core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified failure handling throws std::runtime_error when clock_gettime returns non-zero, correctly reflecting the RELEASE_ASSERT crash semantics in CPUTimePOSIX.cpp instead of returning a silent 0.0. - core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: Verified concurrency safety of std::atomic<ClockQuery> g_clock and confirmed CpuTimeClockForTest_nid_no_patch safely falls back to GuestClockGettime when passed nullptr. - core/libs/prx/libSceNKWebKit/src/WtfTime.cpp: Verified clean removal of the host-dependent _ZN3WTF7CPUTime16forCurrentThreadEv implementation without disturbing adjacent WTF time exports. - core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp: Verified test coverage across TestReportedTime (conversion precision against clock ID 14), TestFailingClock (exception throwing), TestGuestClock (clock advancement), and TestGuestClockCountsOnlyThisThread (validating that clock 14 accounts strictly for the current thread's CPU time). - docs/dev/debt/changes/fix-nkwebkit-cputime.md: Verified technical debt fragment structure, conventional commit PR title, and absence of code comments violating AGENTS.md rules. - Note: the AI-assisted checkbox can stay. Requesting changes for the points above.
MarcZX10 commented 2026-11-14 21:27:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T21:27:58Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the implementation and tests provide evidence for the guest thread clock behavior on the reported Linux build, while console behavior remains unverified.

What I ran

Reviewed head 917e604ff3de161c21ddd1c628bc840d2e248d88 using repo_read.py against the prepared review bundle and pinned repository. No commands or tests were run during this review. The description reports Linux build and test results; those were not independently run.

Results

Check Result Note
Changed code review passed Implementation, test, and debt fragment read
Tests during review not run Author-reported results only
Console behavior not run No title-process measurement confirmed

Findings

Blocking

None.

Non-blocking

None.

Not verified

  • No local build, tests, Windows run, or console/title-process measurement was performed.
  • All changed files listed as reviewed were read: core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp, core/libs/prx/libSceNKWebKit/src/WtfTime.cpp, core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp, and docs/dev/debt/changes/fix-nkwebkit-cputime.md. No changed files were excluded in the manifest.
  • The PR description notes that console modules importing this NID were not checked against a dump.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5907235160 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5907235160). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T21:27:58Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the implementation and tests provide evidence for the guest thread clock behavior on the reported Linux build, while console behavior remains unverified. ## What I ran Reviewed head `917e604ff3de161c21ddd1c628bc840d2e248d88` using `repo_read.py` against the prepared review bundle and pinned repository. No commands or tests were run during this review. The description reports Linux build and test results; those were not independently run. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | Implementation, test, and debt fragment read | | Tests during review | not run | Author-reported results only | | Console behavior | not run | No title-process measurement confirmed | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified - No local build, tests, Windows run, or console/title-process measurement was performed. - All changed files listed as reviewed were read: `core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp`, `core/libs/prx/libSceNKWebKit/src/WtfTime.cpp`, `core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp`, and `docs/dev/debt/changes/fix-nkwebkit-cputime.md`. No changed files were excluded in the manifest. - The PR description notes that console modules importing this NID were not checked against a dump. ## To get this to a good state Nothing is required.
PrivacyOnion commented 2026-11-15 21:18:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T21:18:05Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 917e604ff3:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_wtfcputime_tests built cleanly.
  • CTest (nkwebkit_wtfcputime):
    1/1 Test #4272: nkwebkit_wtfcputime ..............   Passed    0.38 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/src/WtfTime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp queries guest clock_gettime_nid_postfix(14, &time) (FreeBSD CLOCK_THREAD_CPUTIME_ID), throws std::runtime_error on non-zero return matching upstream RELEASE_ASSERT, and converts tv_sec + tv_nsec / 1000 / 1000 / 1000 matching WTF::Seconds::fromNanoseconds.
    • Verified core/libs/prx/libSceNKWebKit/src/WtfTime.cpp removes the old host-direct _ZN3WTF7CPUTime16forCurrentThreadEv definition cleanly with no duplicate symbols or dangling helpers.
    • Verified thread safety and memory safety in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: KernelTimespec is stack-initialized, g_clock is std::atomic defaulting to GuestClockGettime, and CpuTimeClockForTest_nid_no_patch(nullptr) safely restores GuestClockGettime.
    • Verified cross-platform LP64/LLP64 portability: no platform-specific headers or narrowing conversions in WtfCpuTime.cpp or tests/WtfCpuTime.cpp.
    • Verified core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp covers exact nanosecond division arithmetic, failure throwing, live guest clock progression, and per-thread CPU time isolation while resetting the test clock hook.
    • Verified docs/dev/debt/changes/fix-nkwebkit-cputime.md properly records the WTF host services update and Functional debt entry for WTF::CPUTime::forCurrentThread, and all mechanical convention/build/test gates passed.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5912977410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20139#pullrequestreview-5912977410). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T21:18:05Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `917e604ff3`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_wtfcputime_tests` built cleanly. - **CTest** (`nkwebkit_wtfcputime`): ``` 1/1 Test #4272: nkwebkit_wtfcputime .............. Passed 0.38 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/src/WtfTime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp queries guest clock_gettime_nid_postfix(14, &time) (FreeBSD CLOCK_THREAD_CPUTIME_ID), throws std::runtime_error on non-zero return matching upstream RELEASE_ASSERT, and converts tv_sec + tv_nsec / 1000 / 1000 / 1000 matching WTF::Seconds::fromNanoseconds. - Verified core/libs/prx/libSceNKWebKit/src/WtfTime.cpp removes the old host-direct _ZN3WTF7CPUTime16forCurrentThreadEv definition cleanly with no duplicate symbols or dangling helpers. - Verified thread safety and memory safety in core/libs/prx/libSceNKWebKit/src/WtfCpuTime.cpp: KernelTimespec is stack-initialized, g_clock is std::atomic<ClockQuery> defaulting to GuestClockGettime, and CpuTimeClockForTest_nid_no_patch(nullptr) safely restores GuestClockGettime. - Verified cross-platform LP64/LLP64 portability: no platform-specific headers or narrowing conversions in WtfCpuTime.cpp or tests/WtfCpuTime.cpp. - Verified core/libs/prx/libSceNKWebKit/tests/WtfCpuTime.cpp covers exact nanosecond division arithmetic, failure throwing, live guest clock progression, and per-thread CPU time isolation while resetting the test clock hook. - Verified docs/dev/debt/changes/fix-nkwebkit-cputime.md properly records the WTF host services update and Functional debt entry for WTF::CPUTime::forCurrentThread, and all mechanical convention/build/test gates passed. Looks Good To Me
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!20139
No description provided.