diff --git a/src/Builtin/BaseProcesses.cs b/src/Builtin/BaseProcesses.cs index 3a25389..eabd58d 100644 --- a/src/Builtin/BaseProcesses.cs +++ b/src/Builtin/BaseProcesses.cs @@ -142,7 +142,9 @@ public void Run() for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++) { var pair = _pairs[i]; +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].Begin(); +#endif try { pair.run.Run(); @@ -159,7 +161,9 @@ public void Run() { pair.cleanup?.RunFinally(); } +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].End(); +#endif } #else foreach (var item in Process) diff --git a/src/EcsPipeline.Builder.cs b/src/EcsPipeline.Builder.cs index e06c7ae..fdff505 100644 --- a/src/EcsPipeline.Builder.cs +++ b/src/EcsPipeline.Builder.cs @@ -307,7 +307,7 @@ public Builder Remove() #endif public EcsPipeline Build() { -#if DEBUG +#if DEBUG && !DRAGONECS_DISABLE_PROFILER_MARKERS _buildMarker.Begin(); #endif var it = new LinkedListCountIterator(_systemNodes, _systemNodesCount, _startIndex); @@ -373,7 +373,7 @@ public EcsPipeline Build() { item.Declare(pipeline); } -#if DEBUG +#if DEBUG && !DRAGONECS_DISABLE_PROFILER_MARKERS _buildMarker.End(); #endif return pipeline; diff --git a/src/EcsPipeline.cs b/src/EcsPipeline.cs index a8ca5d0..cd2f8a5 100644 --- a/src/EcsPipeline.cs +++ b/src/EcsPipeline.cs @@ -208,7 +208,7 @@ public void Init() EcsDebug.PrintWarning($"This {nameof(EcsPipeline)} has already been initialized"); return; } -#if DEBUG +#if DEBUG && !DRAGONECS_DISABLE_PROFILER_MARKERS _initMarker.Begin(); #endif @@ -219,7 +219,7 @@ public void Init() _isInit = true; GC.Collect(); -#if DEBUG +#if DEBUG && !DRAGONECS_DISABLE_PROFILER_MARKERS _initMarker.End(); #endif } diff --git a/src/EcsRunner.cs b/src/EcsRunner.cs index 32a015e..4d88a79 100644 --- a/src/EcsRunner.cs +++ b/src/EcsRunner.cs @@ -201,7 +201,9 @@ public void Run(Action translationCallback) CheckCache(translationCallback); for (int i = 0, n = _process.Length < _markers.Length ? _process.Length : _markers.Length; i < n; i++) { +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].Begin(); +#endif try { translationCallback(_process[i]); @@ -214,7 +216,9 @@ public void Run(Action translationCallback) EcsDebug.PrintError(e); #endif } +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].End(); +#endif } #else foreach (var item in _process) @@ -242,7 +246,9 @@ public void Run(ActionWithData translationCallback, ref CheckCache(translationCallback); for (int i = 0, n = _process.Length < _markers.Length ? _process.Length : _markers.Length; i < n; i++) { +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].Begin(); +#endif try { translationCallback(_process[i], ref data); @@ -255,7 +261,9 @@ public void Run(ActionWithData translationCallback, ref EcsDebug.PrintError(e); #endif } +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].End(); +#endif } #else foreach (var item in _process) @@ -370,7 +378,9 @@ public void Run( for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++) { var pair = _pairs[i]; +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].Begin(); +#endif try { translationCallback(pair.run); @@ -390,7 +400,9 @@ public void Run( translationFinnalyCallback(pair.runFinally); } } +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].End(); +#endif } #else foreach (var item in _pairs) @@ -426,7 +438,9 @@ public void Run( for (int i = 0, n = _pairs.Length < _markers.Length ? _pairs.Length : _markers.Length; i < n; i++) { var pair = _pairs[i]; +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].Begin(); +#endif try { translationCallback(pair.run, ref data); @@ -446,7 +460,9 @@ public void Run( translationFinnalyCallback(pair.runFinally, ref data); } } +#if !DRAGONECS_DISABLE_PROFILER_MARKERS _markers[i].End(); +#endif } #else foreach (var pair in _pairs)