Repository navigation
feat(libc): write the called imports to APS5_TRACE_CALLS_FILE every 10 seconds - #9439
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
f1a1c05 to
2049d64
Compare
MarcZX10
left a comment
There was a problem hiding this comment.
The fixed-capacity import records remain stable while counts are sampled atomically, the output sorts every nonzero record with deterministic tie ordering, and the Linux report covers both the on-demand API and periodic file snapshots during real title runs (including runs later killed). Windows validates the direct path-writing API, while the periodic thread itself is explicitly untested there.
The branch was rebased onto 6ef5a1c4c9, but current upstream main has since advanced to 17f5335562. Please update to current main and rerun the focused guest_call_trace tests plus conventions and overlap. Since the file-path/environment handling has a Windows-specific _wgetenv branch, please also run the updated Windows focused test or state why that environment is unavailable. Hosted product jobs remain skipped. I did not run local tests.
2049d64 to
ba73390
Compare
|
@MarcZX10 rebased onto On Windows the tests cover AI-assisted: yes (Claude Code) |
|
Used this branch (main Stubs actually called (call count in parentheses):
Absent imports actually called:
Not covered: runs were not played past title/boot, so anything only reached in gameplay is missing. Titles that abort before tracing (ufc5 at AI-assisted: yes. Written with AI assistance and reviewed by me. |
|
@klosixgaming-arch thanks, that is exactly the use this was for: what titles call rather than what they link. I added it to Tested. AI-assisted: yes (Claude Code) |
…0 seconds A traced run that ends without a crash or an abort never reports which imports it called. With APS5_TRACE_CALLS_FILE set, the first traced import starts a thread that rewrites that file every 10 seconds with every import called so far, most called first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ba73390 to
a938dd8
Compare
|
@MarcZX10 rebased onto current
AI-assisted: yes (Claude Code) |
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Checked the writer against |
|
Thanks for checking the writer and the exact-file tests, and for merging, @adriadam10. AI-assisted: yes (Claude Code) |
What
An executable converted with
--trace-importscounts its calls to the libraries inAPS5_TRACE_CALLS, but only a crash or an abort report prints them, and then only the 32 most called imports. A run that ends normally, or is killed at a timeout, leaves no record of what it called.With
APS5_TRACE_CALLS_FILEset to a path, the first traced import starts a thread that rewrites that file every 10 seconds. It holds one line per import called so far, most called first: the number of calls, the library and the import name. A run that is killed keeps its last rewrite.I used it to list what the 10 retail games on my test host actually call (200 to 476 different imports in 2 to 5 minutes each) and to check which of them reach a function that still has a
NotImplemented_nid_no_patchpath. The crash report couldn't answer that, because none of those runs crashed in a library.How
CallTrace.cpp:WriteCallCountstakes every import record with a nonzero count, sorts the records by count (stable, so equal counts keep their order), and writes the lines through astd::ofstreamon astd::filesystem::path.StartCallCountWriterruns once, when the first traced import sets up the trace. It readsAPS5_TRACE_CALLS_FILE, through_wgetenvon Windows as the other path variables do, and starts a detached thread that rewrites the file every 10 seconds.WriteCallCounts_nid_no_patch(const char* utf8Path)writes the same file on demand. It returns false for a null or empty path, or when the file can't be written. The test uses it.ENVIRONMENT.md,TRACING.mdand the tracing section ofUSAGE.mddescribe the variable.Tested
main17f5335, with no conflicts, as headba73390965.guest_call_traceandguest_call_trace_abortpass 3 of 3 on Linux (Ubuntu 26.04.1, GCC 15.2, Release), and 3 of 3 on the Windows 11 VM (WinLibs GCC 15.2.0, Release) on this head and on its merge base. Conventions are clean, and the overlap scan shows no line-level overlap. The Windows runs cover the direct path-writing call; the 10-second writer thread is still exercised only by the Linux title runs below. The other results are from pre-rebase heads.Linux (Ubuntu 26.04.1, GCC 15.2, Release), on
main0c6a5bd, then rebased onto a6dcea9. That merge doesn't touch these files.guest_call_trace,guest_call_trace_abortandguest_call_trace_abort_racepass 3 of 3.The new checks in
guest_call_tracerun after the existing calls and compare the written file exactly:80001 Integers,3 Blocks,2 Doubles,1 Mixed,1 Variadic, in that order, each with the library name it was traced under. They also check that a path under a regular file, a null path and an empty path return false.On
mainthe test doesn't build, becauseWriteCallCounts_nid_no_patchis new.Titles: Steins;Gate, Ghost of Tsushima, Forspoken, MGS4, Astro Bot, Crimson Desert, MXGP 26, Super Meat Boy 3D, CoD Black Ops II and Borderlands 4, converted with
--trace-imports,APS5_TRACE_CALLS=allandAPS5_TRACE_CALLS_FILE=calls.txt, for 120 to 300 s each. Every run left its file (204 to 476 lines), including the two that were killed (Ghost of Tsushima at 54 s, Astro Bot at 75 s). These runs used an earlier local version of this change that wrote the same lines unsorted.Windows 11 VM, WinLibs GCC 15.2.0, Release, head f1a1c05 and its merge base a6dcea9:
guest_call_traceandguest_call_trace_abort(the two that run on Windows) pass 3 of 3 on both. So the new checks, the exact file contents included, pass there.Not tested: macOS, and the 10-second writer thread on Windows (the test calls
WriteCallCounts_nid_no_patchdirectly; the titles above ran on Linux).main1a745ae and this branch,APS5_TRACE_CALLS=all, about 2 minutes each. It showed which census stubs and absent imports titles actually call, not just link:sceSystemServiceParamGetIntin all 13 titles that boot far enough, andtimespec_get19,588 times in one title (feat(libc): implement C11 timespec_get for PPSA34015 #9388's case).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code