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
+29 -5
View File
@@ -28,6 +28,8 @@ internal class Program
{
//systems.Add(new ParentSystem(world));
systems.Add(new LocalToWorldSystem(world));
systems.Add(new LocalToWorldThreadedSystem(world));
editorSystems.Add(new EditorProfilerWindow(world));
editorSystems.Add(new EditorHierarchyWindow(world));
Entity ent1 = world.CreateEntity("parent");
@@ -47,6 +49,20 @@ internal class Program
Entity ent5 = world.CreateBaseEntity("entity5");
for (int i = 0; i < 10; i++)
{
Entity newEnt = world.CreateBaseEntity();
world.Set(newEnt, new LocalTransform(new Vector3(i, i, i), Quaternion.Identity, Vector3.One));
Entity parent = newEnt;
for (int j = 0; j < 10; j++) {
Entity newChildEnt = world.CreateEntity();
world.Set(newChildEnt, new LocalTransform(new Vector3(j, j, j), Quaternion.Identity, Vector3.One));
Transform.SetParent(world, newChildEnt, parent);
parent = newChildEnt;
}
}
// Open project.
// Setip EditorGui.
EditorGui.Initialize();
@@ -56,16 +72,24 @@ internal class Program
{
foreach (MoonTools.ECS.System system in systems)
{
system.Update(Engine.Timestep);
using (new ProfilerScope(system.GetType().Name))
{
system.Update(Engine.Timestep);
}
}
// Editor Update.
EditorGui.Update();
using (new ProfilerScope("EditorGui.Update"))
{
// Editor Update.
EditorGui.Update();
}
// Try Catch UserCode Update.
world.FinishUpdate();
using (new ProfilerScope("world.FinishUpdate"))
{
world.FinishUpdate();
}
}
private static void HandleOnRender()