startup: optional Tracy zones for the stand-ins (off by default) #2363
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2371"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T14:02:03Z.
Change
An optional
-DX2W_TRACY=ONCMake option linksd3d12_xs.dll,XCRDAPI.dllandxmem.dllagainst the Tracy client and turns on named zones and a frame mark in a few hot places of the stand-in runtime. It is a developer measurement build for finding where a run spends time, not a behavior change.X2W_ZONE/X2W_FRAME_MARKmacros insrc/startup_stubs/profile_zone.hexpand to nothing.FetchContentonly when the option is on, pinned to commitf2a4f2529e7e71844c9e434b877770a21ecf7587.-DFETCHCONTENT_SOURCE_DIR_TRACY=<checkout>reuses an existing checkout and-DFETCHCONTENT_FULLY_DISCONNECTED=ONforbids any download. No Tracy source or binary is committed; the license note is indocs/startup-runtime.md.TRACY_ONLY_LOCALHOST,TRACY_NO_BROADCAST, no call stacks, no system tracing, no crash handler.TracyClient.dlland listing the process's listening sockets). This build must not be used where a run is meant to stay offline; the docs say so.ExecuteCommandLists,Presentwith a frame mark, the frame-wait sleep, window present, desktop pipeline creation,device_memory_srvand its four resource scans, each DirectStorage request, and the xmem page map and physical write.AI-assisted (Claude Code); the commands below were run locally.
Verification
Base
43608f2e(origin/main), headdfa0195b. Windows 11 build 26300, MSVC 14.44, CMake 3.28, Ninja.cmake --preset dev -DINTAKE_PYTHON=<venv python>,cmake --build --preset dev:X2W_TRACY:BOOL=OFF, no_depsdirectory (nothing fetched).ctest --preset dev --no-tests=error -R "desktop_root_signature|era_heap_allocation|offscreen_warp|startup_memory_srv|startup_placement|startup_indirect_draw_warp|xmem_mapped_pages|startup_present": 28 passed, 0 skipped, 0 failed with the default build, and 28 passed, 0 skipped, 0 failed with theX2W_TRACY=ONbuild (ctest --test-dir out/build/tracy-on).cl /EPon a unit that uses the macros printsint f(){ ; ; return 1; };dumpbin /importsond3d12_xs.dll,xmem.dllandXCRDAPI.dllof the default build lists no Tracy import.cmake --preset dev -B out/build/tracy-on -DX2W_TRACY=ON -DFETCHCONTENT_SOURCE_DIR_TRACY=<checkout at the pinned commit> -DFETCHCONTENT_FULLY_DISCONNECTED=ON, thencmake --build: 2904/2904 steps. The three DLLs importTracyClient.dll.TracyClientcompiles with-DTRACY_ENABLE -DTRACY_ON_DEMAND -DTRACY_ONLY_LOCALHOST -DTRACY_NO_BROADCAST -DTRACY_NO_CALLSTACK -DTRACY_NO_SYSTEM_TRACING -DTRACY_NO_CRASH_HANDLER.xmem.dll,d3d12_xs.dllandXCRDAPI.dll, stays up 9 s while Tracy'scapture -a 127.0.0.1 -s 3connects (3 frames of connection, trace saved), frees the three DLLs (TracyClient.dllunloads with them) and returns frommainnormally. The same program without a capture attached also exits normally. The client starts in its DLL's static initializer (noTRACY_DELAYED_INIT).src/xmem_mapped_pages.cpp(lazy_commit_fault,retry_remapped_page) calls a zoned function, so no zone runs on a faulting thread inside a handler (by reading).python -B tests/docs_links_check.py(19 files, 459 links),python -B tests/bidi_controls_check.py: pass.git diff --check origin/main...HEAD: clean.The selection includes
startup_present_view_hardware, which uses a physical adapter; adapter, driver and debug-layer status were not recorded, so no result here is a GPU report. The fetch path itself (a download of the pinned commit) was not exercised in this run; the ON build used a local checkout at the same commit.Evidence and follow-up
Local observation, one instrumented local run that is not reproducible from the repository: a capture located a by-address lookup that walked a never-pruned resource table on every call (fixed separately in #2343) and showed that the apparent cost of the list threads was waiting, not work. This PR adds only the means to take such a capture.
How to capture without a GUI is in the new docs section (Tracy's
capturetool,-a 127.0.0.1).Follow-ups, each its own PR:
Left out on purpose: the command-list slot zones and counter plots, because they sit in a template on the per-call hot path and need an
#ifblock there; they belong in a follow-up with an overhead measurement. Not covered: no overhead measurement of the ON build, and no claim about full-title startup.Checklist
🤖 Generated with Claude Code