%% where the perf harness measures a frame. bench.exe times its own calls; MTL12_PERF times the layer's unix side in any program. flowchart TB A["Windows program
(bench.exe or an app)"] -- "record:
Reset..Close" --> B["d3d12core.dll
(PE side)
records commands"] B -- "ExecuteCommandLists
= submit" --> C["mtl12.so
(unix side)
replays into Metal"] C --> D["Metal 4
command buffers"] D --> E["GPU"] E -. "timestamps around
the list = gpu_us" .-> A C -. "MTL12_PERF: thread CPU time
per call, by kind" .-> F["one JSON line
per Present"] E -. "commit feedback:
GPU start/end" .-> F A -. "QueryPerformanceCounter:
record, submit, frame" .-> G["result: line"] F --> H["run script:
median, p95, p99
+ history file"] G --> H