Repository navigation
dstorage, fs: LEONIDA_IO_TRACE logs every read the title asks for, flushed as it goes (RT-IO-TRACE) - #1931
dstorage, fs: LEONIDA_IO_TRACE logs every read the title asks for, flushed as it goes (RT-IO-TRACE)#1931kawaii-shakal wants to merge 4 commits into
Conversation
…ushed as it goes (RT-IO-TRACE) When a boot stops, the startup trace names the files the title opened, but most of its reading goes through DirectStorage requests and ReadFile on files it opened long before. With LEONIDA_IO_TRACE=<file>, each DirectStorage request (file, offset, sizes, zlib/BCPack, request name) and each ReadFile, ReadFileEx or ReadFileScatter on a disk file (path, offset, size) is one line with the local time. The line is flushed at once into a file shared for reading, so the last reads before a crash are on disk and can be watched while the game runs. Paths are asked of the handle each time, because a handle value is reused after a close. io_trace_test covers positioned, overlapped and reused-handle reads, DirectStorage lines with good and bad name pointers, and pipes being left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict resolution assisted by Codex.
|
Verified on Windows 11 (
AI-assisted. |
|
With clang-cl, the new
target_compile_options(io_trace_test PRIVATE /W4 /permissive- /utf-8 $<$<CXX_COMPILER_ID:Clang>:/EHa>)the test passes, 3/3 runs (MEASURED, same machine). With MSVC it passes as is, which matches the MSVC run above; I have not run MSVC myself. Not checked by a second agent or human yet. AI-assisted (Claude Code). |
…aught (RT-IO-TRACE) copy_name reads the title's name inline in its __try. MSVC always catches that fault; clang-cl only with asynchronous exceptions, and io_trace_test was built without them (dstorage.cpp has them through its source property), so under clang-cl the safe_name(16) check ended the test with an unhandled page fault. Reported by Tauwni on ProjectLeonida#1931 (clang-cl cross build, Wine 11). Reproduced with clang-cl 21 under Wine: 3 of 3 runs crash at 0x10 without /EHa, 3 of 3 pass with it. The header comment now says a caller needs /EHa under clang-cl. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JPqXc6svM4pbBagTsVEYA3
|
Thanks, confirmed and fixed in 7d571f7: AI-assisted (Claude Code); I ran the builds and checked the results. Generated by Claude Code |
|
#1931 | head 7d571f7 (merged cleanly onto origin/main c8bf0e7) | Windows 11 (10.0.26200.9974), MSVC 19.44.35228 (x64), Python 3.12.10 | AI-assisted: yes Summary — PASS (Re-verification of updated head
|
|
Verified by OreoFR
Note: shares AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as RT-IO-TRACE: #1608 (comment)
Problem
When a boot stops,
--tracenames the files the title opened (the first 600 opens), but not what it was reading. Most of the reading goes through DirectStorage requests andReadFileon files opened long before the stop. In a 1.0.2.1 boot here, the last open came 4 minutes before the device loss.Change
With
LEONIDA_IO_TRACE=<file>, every read is one line, starting with the local time (as themem-probelines do):ds: each DirectStorage request atEnqueueRequest, with file (or<memory>), file offset, source and destination sizes, zlib, BCPack and the request's name. The name pointer is the title's, so it is copied under SEH.rf: eachReadFile,ReadFileExandReadFileScatteron a disk file, with path, offset (theOVERLAPPED's, else the handle's position) and size. The path is asked of the handle every time, because a handle value is reused after a close._wfsopen(..., _SH_DENYNO)). The last reads before a crash or device loss are on disk, and the file can be watched during the boot.It is off by default; without the variable nothing is formatted.
runtime/shims/io_trace.himplements it, with hooks indstorage.cppandfile_system.cpp.docs/boot.mddocuments the variable.Tested (Windows 11 Pro 26300, VS 2026 RelWithDebInfo)
io_tracecovers positioned, overlapped and reused-handle reads, DirectStorage lines with a good, a bad and a null name pointer, pipes left out, and reading the trace while it is open.dstorageandfile_systempass too.anim.rpf,levels.rpf,core_bvh4.rpfandpacks.rpf, with all reads stopping at the moment of the loss.🤖 Generated with Claude Code