Profiler and LocalToWorldThreadedSystem

Added a simple profiler
Testing LocalToWorldSystem with Parallel execution for root nodes
This commit is contained in:
max
2024-10-19 23:41:05 +02:00
parent 6be63195f0
commit 82fe47f627
8 changed files with 434 additions and 17 deletions
+14
View File
@@ -111,10 +111,14 @@ public static class Engine
private static void Tick()
{
Profiler.BeginFrame();
AdvanceElapsedTime();
if (framerateCapped)
{
Profiler.BeginSample("framerateCapped");
/* We want to wait until the framerate cap,
* but we don't want to oversleep. Requesting repeated 1ms sleeps and
* seeing how long we actually slept for lets us estimate the worst case
@@ -137,6 +141,8 @@ public static class Engine
Thread.SpinWait(1);
AdvanceElapsedTime();
}
Profiler.EndSample();
}
// Do not let any step take longer than our maximum.
@@ -149,6 +155,7 @@ public static class Engine
{
while (accumulatedUpdateTime >= Timestep)
{
Profiler.BeginSample("Update");
Keyboard.Update();
Mouse.Update();
GamePad.Update();
@@ -156,19 +163,26 @@ public static class Engine
ProcessSDLEvents();
// Tick game here...
Profiler.BeginSample("OnUpdate");
OnUpdate?.Invoke();
Profiler.EndSample();
AudioDevice.WakeThread();
accumulatedUpdateTime -= Timestep;
Profiler.EndSample();
}
double alpha = accumulatedUpdateTime / Timestep;
// Render here..
Profiler.BeginSample("OnRender");
OnRender?.Invoke();
Profiler.EndSample();
accumulatedDrawTime -= framerateCapTimeSpan;
}
Profiler.EndFrame();
}
private static TimeSpan AdvanceElapsedTime()