Profiler threading support, flame graph

Changed the profiler into a node based system for better data access, more overhead than the simple struct+depth info but can hold more detail and less post processing of data
Profiler now also profiles threads
Added some test profile tags
The profiler window now also has a FlameGraph
This commit is contained in:
max
2024-10-20 23:17:41 +02:00
parent 2c84e650d6
commit 567714a52d
4 changed files with 371 additions and 101 deletions

View File

@ -15,7 +15,7 @@ namespace Nerfed.Runtime.Systems
{
public class LocalToWorldSystem : MoonTools.ECS.System
{
private readonly bool useParallelFor = false; // When having a low amount of transforms or when in debug mode this might be slower.
private readonly bool useParallelFor = true; // When having a low amount of transforms or when in debug mode this might be slower.
private readonly Filter rootEntitiesFilter;
private readonly Filter transformEntitiesFilter;
private readonly Action<int> updateWorldTransform;
@ -62,15 +62,19 @@ namespace Nerfed.Runtime.Systems
{
foreach (Entity entity in rootEntitiesFilter.Entities)
{
Profiler.BeginSample("UpdateWorldTransform");
UpdateWorldTransform(entity, Matrix4x4.Identity);
Profiler.EndSample();
}
}
}
private void UpdateWorldTransformByIndex(int entityFilterIndex)
{
Profiler.BeginSample("UpdateWorldTransformByIndex");
Entity entity = rootEntitiesFilter.NthEntity(entityFilterIndex);
UpdateWorldTransform(entity, Matrix4x4.Identity);
Profiler.EndSample();
}
private void UpdateWorldTransform(in Entity entity, Matrix4x4 localToWorldMatrix)