Repository navigation
Conversation
Each GfxContext now owns a NodeProfiler that its render lists fill while it is enabled: one FrameTiming per frame and output, with, for every node, the render-thread time of its update and command recording, its GPU time, and the bytes of the render targets the list allocates for its inputs. GPU time comes from timestamps written between passes (Vulkan timestamp query pools, desktop GL timer queries; other backends report CPU time only). Each stamp closes the span since the previous one and gives it to the nodes passed: a source's initial passes to that source, the shared pass of a sink input split evenly between the sources drawing into it, preview taps to no one. Passes can overlap on the GPU, so the split is per node rather than exact, and a node whose time includes such a split says so (gpu_shared). Results are read four frames later, without waiting: a frame whose GPU results are not ready is reported with its CPU times only, and one whose slot was not revisited four frames later is dropped. Preview outputs are not profiled. The profiler of a render list is created once profiling is on, after the list rebuilt itself for the frame (an output resized releases it), and released when profiling goes off, with its query pools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KdPgufk1W2MBbpcjraruZq
The Benchmark setting only ever measured each node's run() in the audio graph, once every 50 ticks, and showed one percentage in the process header. A gfx process's audio node only queues messages for the render thread, so its real cost never appeared. Execution::Profiler, owned by the execution document plug-in, now keeps per process: audio time per tick and its share of the ticks' duration, render-thread and GPU time per frame (fed by the graphics plug-in from the render lists' NodeProfiler, nodes mapped to processes through their gfx_exec_node ids), render-target memory, and averages and maxima over the last 64 samples; plus the audio load and frame times over time, and the ticks and frames over a threshold with their slowest nodes. - The benchmark tick measures every tick, accumulates per node, and reports every 50 ticks; load is computed against the ticks' actual durations. - Process headers show the dominant cost (GPU ms for gfx nodes, % of the tick for audio ones) through a new benchmarkLabel signal. - A Profiler panel (Ctrl+Alt+P): Benchmark toggle, spike thresholds, timelines, a sortable per-process tree grouped by interval with subtotals and bars, click to select, "selected only", the kept spikes, JSON export. - Score.profile(), clearProfile(), profiling() / setProfiling() (the Benchmark setting, which is saved) and setProfileSpikes() in scripts. profile() first pulls the measures still queued, as a script driving renderFrames() blocks the timers that would otherwise. The audio thread never allocates for this: three reports go round between it and the GUI through preallocated queues (AudioBenchChannel), the per-node map keeps its capacity, and a report keeps at most 16 spikes of its 8 slowest nodes in fixed arrays. The GUI takes the reports with the edit commands, and profile() takes them alone. A header shows its label only when it changes, a GPU time that includes a shared pass with a "~", and the labels go when Benchmark is turned off. The old benchmark(double) signal goes: headers clear through benchmarkLabel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KdPgufk1W2MBbpcjraruZq
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Benchmark setting only measured each node's
run()in the audio graph, once every 50 ticks, and showed one percentage in the process header. A gfx process's audio node only queues messages for the render thread, so the real cost of graphics never showed up anywhere. This adds a profiler that covers both the audio graph and the render thread, including GPU time, with a panel and a script API.Graphics side (
Gfx/Graph/NodeProfiler):GfxContextowns aNodeProfiler. Its render lists fill it while profiling is on: oneFrameTimingper frame and output, with, for every node, the render-thread time of its update and command recording, its GPU time, and the bytes of the render targets the list allocates for its inputs.gpu_shared. Results are read four frames later without waiting. Frames whose GPU results are not ready are reported with CPU times only. Preview outputs are not profiled.Engine side (
Execution/Profiler):Execution::Profiler, owned by the execution document plug-in, keeps, per process: audio time per tick and its share of the tick, render-thread and GPU time per frame (nodes mapped to processes through theirgfx_exec_nodeids), render-target memory, and averages and maxima over the last 64 samples. It also keeps the audio load and frame times over time, plus the ticks and frames over a threshold, with their slowest nodes.benchmarkLabelsignal: GPU ms for gfx nodes, % of the tick for audio nodes. A "~" marks a GPU time that includes a shared pass. The oldbenchmark(double)signal is removed.Score.profile(),clearProfile(),profiling()/setProfiling()(the saved Benchmark setting) andsetProfileSpikes().The audio thread never allocates for this. Three reports circulate between it and the GUI through preallocated queues (
AudioBenchChannel), the per-node map keeps its capacity, and a report keeps at most 16 spikes of its 8 slowest nodes in fixed arrays.Commits
66ca39cacbgfx: per-node render timings. A render list creates its profiler once profiling is on, after it has rebuilt itself for the frame (an output resize releases it). It releases the profiler, with its query pools, when profiling goes off.0ea473eeb6engine: execution profiler for audio and render nodes.profile()first pulls the measures still queued, because a script drivingrenderFrames()blocks the timers that would otherwise collect them.Tests
test_unit_profiler: series keep their last values, render frames feed nodes and totals, frames over the threshold are kept with their slowest nodes, audio load is computed over the report's whole duration, per-kind spike caps, spike generation past the cap, and audio reports circulating between the audio thread and the GUI.test_unit_gfx_node_profiler: without GPU timestamps a frame is submitted with its CPU times.test_gfx_profiler_rebuild: profiling survives an output rebuild and being turned off and on.test_gfx_shader_corpus_targets,test_gfx_window_layout,test_threedim_ply_fingerprint,test_unit_miniaudio_alsaand the few others master's run lists).Notes for review
Process::ProcessModel::benchmark(double)is an API change for plug-ins that connected to it.gpu_sharedflag and the "~" in headers say so.lastCompletedGpuTime()(seconds) as milliseconds. That is fixed later in the series, in the multi-window output PR (bdbf376952), not here.🤖 Generated with Claude Code
https://claude.ai/code/session_01KdPgujQFUTMVZBdH6Hv7Vj