Repository navigation
Record profiles in CPU, GPU and memory tracks - #12
Conversation
|
Needs more testing as a user before merging. The tests and the sessions listed in the description cover the engine side only. My lead and I will adapt it as needed, and tomorrow I will test it with a separate agent acting as a Mirai user. |
|
Review: rework. This PR builds on code that
|
A host frame can submit more than once (a capture, a thumbnail, a UI texture besides the window), and the renderer kept only the timings of the last submission the GPU finished: a recorded frame lost the passes of its other submissions and was still counted as measured. - rhi.frame_timings also returns the rhi frame those timings measured (Vulkan and Metal), and whether the slot had submitted one. - render copies the timings of every submission into a list (renderer_gpu_submissions) that the host takes and clears each frame. - host gives each submission to the recorded frame whose range of rhi frames holds it. A frame is measured once all of its submissions came back; a recording runs up to PROFILE_GPU_LATE frames past its last one, keeping no zones, until they do. Passes keep where they ran, on the clock of the zones. - editor: the result structs of main gain gpu_measured, gpu_frames and the start_ms of a pass; GPU numbers leave out unmeasured frames. profile.export writes a GPU thread. The profiler panel draws passes where they ran and says when a frame was not measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- platform.process_memory reads the resident and the private memory of the process (Windows private commit, Linux RssAnon+VmSwap, macOS physical footprint) without allocating. It replaces process_memory_bytes, one algorithm; the playtest QA reads the private memory with it. - core.world_memory: the bytes the tables and storages of a World hold behind their pointers, from the capacity of their arrays, maps and slices. It reads capacities, not an allocator, so what game code allocates outside its storages is not in it. - host: profile_start takes memory, off by default. A recording with it samples at the end of each frame, inside the frame as its part memory: the World that ran last (the game loop's, else the editor's), the process and the device memory. - editor: profile.capture takes memory; the summary and the frames gain an optional memory section, profile.export an MB counter. - The profiler panel shows the frame graph, then a CPU, a GPU and a Memory tab, as tall as the tallest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One scale for the World, the private memory and the GPU left the World, tens of MB beside thousands, flat at the bottom of the graph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
world_memory walked the types of every storage at each sample: about 3 ms on demo, most of it in the pools of physics and navigation, whose slots hold arrays of their own. world_info_index now compiles, into World_Schema.memory, where each table value, storage and the Entities hold arrays, maps and slices, with the layout of the elements that hold more; a sample reads only container headers. The bytes are those of the walk by type, which a test checks on a World with nested pools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
171ee60 to
d26240e
Compare
3603803 to
5811c8d
Compare
|
Rebuilt on top of the new #10, as
New: the game's memory.
Cost of the
Panel: CPU, GPU and Memory tabs. Memory draws one band per series, because the World's tens of MB sat flat next to the process's thousands on one scale. Not tested: |
|
Follow-up: the 13–16 ms max of the
|
|
Follow-up: Setup:
How I read it:
|
… ones a failed begin collected - rhi: a slot with no query pool, or whose times the device could not read, is not measured (Vulkan and Metal), instead of measured with no passes. - render keeps the timings a frame_begin collected before it failed, once per rhi frame. - host waits for the GPU times of any recorded frame still missing them, not only of the last one. - The GPU test of the profile has its own file, so --no-gpu runs the others. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…hemselves Each element type is compiled to memory ops once, so a type that holds itself reuses its own range instead of recursing without end; a map reads what its values hold. The ops are private to core and freed with the allocator that made them. The process memory test checks that private memory holds what it wrote, whatever other tests do meanwhile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tabs keep the height of the tallest by stacking the drawings of all of them, and the memory labels take the width of their text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rofiler/tracks # Conflicts: # host/profile_test.odin
Closes #6.
Rebuilt on
main8c5a2a6 after the review; the comment below answers it point by point.Changes
Record the memory of a profile, and show CPU, GPU and memory in tabs
the process (Windows private commit, Linux RssAnon+VmSwap, macOS
physical footprint) without allocating. It replaces
process_memory_bytes, one algorithm; the playtest QA reads the private
memory with it.
behind their pointers, from the capacity of their arrays, maps and
slices. It reads capacities, not an allocator, so what game code
allocates outside its storages is not in it.
samples at the end of each frame, inside the frame as its part memory:
the World that ran last (the game loop's, else the editor's), the
process and the device memory.
an optional memory section, profile.export an MB counter.
Memory tab, as tall as the tallest.
Draw the memory tab as a band per series, from its lowest to its highest
One scale for the World, the private memory and the GPU left the World,
tens of MB beside thousands, flat at the bottom of the graph.
Read the memory of a World from container layouts compiled once
world_memory walked the types of every storage at each sample: about
3 ms on demo, most of it in the pools of physics and navigation, whose
slots hold arrays of their own. world_info_index now compiles, into
World_Schema.memory, where each table value, storage and the Entities
hold arrays, maps and slices, with the layout of the elements that hold
more; a sample reads only container headers. The bytes are those of the
walk by type, which a test checks on a World with nested pools.
Merge order
Merge after #10, which this branch contains: #10, then #12, then #13. Until #10 is in
main, this diff shows #10's commit too; with merge commits it shrinks to this PR's own once #10 lands. All six PRs were merged together ontomainwith no conflict, and the steps ofchecks.ymlpass on that tree (mirai checkon 135 packages, 18 test suites without a GPU).Not tested
bench compare --base main(a coldmaindoes not open on this machine, see Give each GPU pass of a profile to the frame that submitted it, where it ran #10), Linux and macOS (type-checked only).🤖 Generated with Claude Code