1a82742744
build / mod (push) Failing after 28s
Measure-first profile naming the culprit with data; no worker implemented
(step 3.2 is out of scope). docs/measurements/issue-147-cpu-profile/: README +
report-server.json (default server-thread path) + report-inframe.json
(--in-frame control), M5/Metal 2560x1440 HD, same-recording battle with
overlapping raids + explosions + dense smoke, each run serialized under the
shared flock /tmp/airdef-bench.lock (earlier concurrent runs discarded).
Instrumentation: host per-tick tick_mods spans (ground/world/snapshot/wasm/
models/output/total, HORIZON_MOD_CPU_PROFILE=1, attributed by tick+frame),
mod Sim::step phase timing via an adapter-injected monotonic clock
(game.monotonic-nanos, API level 32; airdef-core stays SDK-free), raid_bench
--scheduler + per-frame span/frame correlation + mod phase delta.
Findings: on the default path the battle frame is GPU-bound (GPU avg 73.7ms ~
frame p95 88ms; 127/128 frames >33ms); the mod path is ~2.5ms/tick, per-frame
p99 7.7ms, 0 frames >25ms, host world answers <0.1ms, model prep ~0.05ms; the
872ms CPU spike is a render/GPU hitch (mod 2.15ms). In-frame is CPU-bound
(CPU p99 175ms); the mod path reaches >25ms in 27 frames, and step_drones
dominates Sim::step (52%, max 47ms/tick), A* only 15%. The schedulers' mod
peaks do not coincide; only the render-dominated catch-up spike is common.
Recommendation: a pure A* route worker and a world-snapshot worker are NOT
justified (A* leads only the tiny default-path mod; world answers never lead).
Default-path peaks are GPU -> steps 1-2 (GPU/geometry) apply, a CPU worker
would not help. If targeting in-frame CPU, the unit is the whole Sim::step
(Wasmtime on its own thread), not a route worker — still not implemented.
Harness fix (engine gitlink 48eff0fcb): control-socket chat/chat-log now reach
the client mod on the server-thread path (chat-box parity), enabling the
required default-path battle measurement; sim rules untouched.
Tests: airdef-core 326 passed/0 failed/8 ignored; airdef-mod 113+1+2+5 passed
incl. same_seed_same_result and combat_trace_is_deterministic;
tools/test_raid_bench.py 11 passed; horizon-mods suite + wasm ABI test ok.
Engine: d073783f5 (spans + clock) + 48eff0fcb (chat harness) on
agent/126-cpu-profile. Parent: 92c058f60 (profiler + driver) + this commit.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>