diff --git a/Svelto.ECS/Profiler/EngineInfo.cs b/Svelto.ECS/Profiler/EngineInfo.cs index 038af1c..cd082c7 100644 --- a/Svelto.ECS/Profiler/EngineInfo.cs +++ b/Svelto.ECS/Profiler/EngineInfo.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; - //This profiler is based on the Entitas Visual Debugging tool //https://github.com/sschmid/Entitas-CSharp @@ -8,28 +5,12 @@ namespace Svelto.ECS.Profiler { public sealed class EngineInfo { - enum UpdateType - { - Update = 0, - LateUpdate = 1, - FixedUpdate = 2, - } - readonly IEngine _engine; readonly string _engineName; - readonly Type _engineType; const int NUM_UPDATE_TYPES = 3; const int NUM_FRAMES_TO_AVERAGE = 10; - //use a queue to averave out the last 30 frames - Queue[] _updateFrameTimes = new Queue[NUM_UPDATE_TYPES]; - readonly double[] _accumulatedUpdateDuration = new double[NUM_UPDATE_TYPES]; - readonly double[] _lastUpdateDuration = new double[NUM_UPDATE_TYPES]; - - readonly double[] _minUpdateDuration = new double[NUM_UPDATE_TYPES]; - readonly double[] _maxUpdateDuration = new double[NUM_UPDATE_TYPES]; - double _accumulatedAddDuration; double _minAddDuration; double _maxAddDuration; @@ -58,13 +39,7 @@ namespace Svelto.ECS.Profiler int foundNamespace = _engineName.LastIndexOf("."); _engineName = _engineName.Remove(0, foundNamespace + 1); - - _engineType = engine.GetType(); - - for (int i = 0; i < NUM_UPDATE_TYPES; i++) - { - _updateFrameTimes[i] = new Queue(); - } + ResetDurations(); } @@ -98,14 +73,6 @@ namespace Svelto.ECS.Profiler public void ResetDurations() { - for (int i = 0; i < NUM_UPDATE_TYPES; i++) - { - _accumulatedUpdateDuration[i] = 0; - _minUpdateDuration[i] = 0; - _maxUpdateDuration[i] = 0; - _updateFrameTimes[i].Clear(); - } - _accumulatedAddDuration = 0; _minAddDuration = 0; _maxAddDuration = 0; diff --git a/Svelto.ECS/Sequencer.cs b/Svelto.ECS/Sequencer.cs index 52fad56..b8e7398 100644 --- a/Svelto.ECS/Sequencer.cs +++ b/Svelto.ECS/Sequencer.cs @@ -22,7 +22,14 @@ namespace Svelto.ECS void Step(ref T token, int condition); } - public class Sequencer + public interface ISequencer + { + void Next(IEngine engine, ref T param); + + void Next(IEngine engine, ref T param, int condition); + } + + public class Sequencer : ISequencer { public void SetSequence(Steps steps) { @@ -36,8 +43,7 @@ namespace Svelto.ECS public void Next(IEngine engine, ref T param, int condition) { - var tos = _steps[engine]; - var steps = tos[condition]; + var steps = _steps[engine][condition]; if (steps != null) for (int i = 0; i < steps.Length; i++) @@ -47,8 +53,7 @@ namespace Svelto.ECS Steps _steps; } - //you can inherit from Condition and add yours - public class Condition + public static class Condition { public const int always = 0; }