Add frame market support, and enable on demand tracing.

This commit is contained in:
EliteMasterEric 2024-09-23 16:09:34 -04:00
parent 2a5269c2a7
commit 52f5c24f96
2 changed files with 9 additions and 1 deletions

View file

@ -537,7 +537,7 @@ class Project extends HXProject {
setHaxedef("HXCPP_TELEMETRY"); // Enable telemetry
setHaxedef("HXCPP_TRACY"); // Enable Tracy telemetry
setHaxedef("HXCPP_TRACY_MEMORY"); // Track memory allocations
// setHaxedef("HXCPP_TRACY_ON_DEMAND"); // Only collect telemetry when Tracy is open and reachable
setHaxedef("HXCPP_TRACY_ON_DEMAND"); // Only collect telemetry when Tracy is open and reachable
// setHaxedef("HXCPP_TRACY_INCLUDE_CALLSTACKS"); // Inspect callstacks per zone, inflating telemetry data
setHaxedef("absolute-paths"); // Fix source locations so Tracy can see them

View file

@ -91,6 +91,14 @@ class WindowUtil
windowExit.dispatch(exitCode);
});
#if FEATURE_DEBUG_TRACY
// Apply a marker to indicate frame end for the Tracy profiler.
// Do this only if Tracy is configured to prevent lag.
openfl.Lib.current.stage.addEventListener(openfl.events.Event.EXIT_FRAME, (e:openfl.events.Event) -> {
cpp.vm.tracy.TracyProfiler.frameMark();
});
#end
openfl.Lib.current.stage.addEventListener(openfl.events.KeyboardEvent.KEY_DOWN, (e:openfl.events.KeyboardEvent) -> {
for (key in PlayerSettings.player1.controls.getKeysForAction(WINDOW_FULLSCREEN))
{