Introduce a Tracy/UE-Insights-style scoped-zone profiler that instruments the
engine's core per-frame systems and reports per-module/per-zone self vs total
time plus GPU frame timing.
- common/Profile.* : core zone collector (eve::prof). EV_PROFILE_* RAII macros
push {name,module,thread,parent,depth,start,end} into per-thread buffers;
frameMark() aggregates the frame into a call tree with self/total per module
and zone, sorted by self time. Cheap single-branch no-op when disabled.
Lives in common/ so any module can instrument without layering violations.
- profiler module (SLOT profiler): script API setEnabled()/beginFrame()/
endFrame()/begin()/end()/capture()/textReport()/frameMs()/gpuFrameMs().
Installs itself as the IRenderTracer so render passes become graphics zones.
- Instrument core hot systems: physics (World/World3D), animation, particles,
audio pump, ui render, scene transforms, map tiles, crowd, event pump.
- GPU timing: Vulkan timestamp queries around the present command buffer
(whole-frame), exposed via common/GpuTimer.h IGpuTimer capability provided by
graphics; read after the synchronous submit waits the in-flight fence.
- load.nut drives frameBegin()/endFrame() + section markers, no-op when absent.
- Tests: C++ unit (core aggregation self<total, render-pass zones) + script API.
Verified: all changed TUs compile against real VKBuilder/ECS/zeroerr headers;
module_depgraph.py --check / --check-layers pass. Full-link build blocked in
this env by a prebuilt third-party Squirrel version mismatch (unrelated).
9 lines
254 B
C++
9 lines
254 B
C++
#include "ScriptTest.h"
|
|
|
|
extern const char* profiler_content;
|
|
UnitSciptTest(ProfilerScriptTest, profiler_content);
|
|
|
|
TEST_CASE_FIXTURE(ProfilerScriptTest, "ProfilerScriptTest.capture") {
|
|
CHECK(vm.callFunc(vm.findFunc("captureWorks"), vm).toBool());
|
|
}
|