mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 18:14:37 +08:00
rename ProfilerMarker to EcsProfilerMarker
This commit is contained in:
parent
67a57621d5
commit
a7afdfdde3
@ -1,6 +1,4 @@
|
|||||||
using DCFApixels.DragonECS.Profile;
|
namespace DCFApixels.DragonECS
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public interface IEcsPreInitSystem : IEcsSystem
|
public interface IEcsPreInitSystem : IEcsSystem
|
||||||
@ -25,7 +23,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public sealed class EcsPreInitRunner : EcsRunner<IEcsPreInitSystem>, IEcsPreInitSystem
|
public sealed class EcsPreInitRunner : EcsRunner<IEcsPreInitSystem>, IEcsPreInitSystem
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
private ProfilerMarker[] _markers;
|
private EcsProfilerMarker[] _markers;
|
||||||
#endif
|
#endif
|
||||||
public void PreInit(EcsPipeline pipeline)
|
public void PreInit(EcsPipeline pipeline)
|
||||||
{
|
{
|
||||||
@ -43,10 +41,10 @@ namespace DCFApixels.DragonECS
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
protected override void OnSetup()
|
protected override void OnSetup()
|
||||||
{
|
{
|
||||||
_markers = new ProfilerMarker[targets.Length];
|
_markers = new EcsProfilerMarker[targets.Length];
|
||||||
for (int i = 0; i < targets.Length; i++)
|
for (int i = 0; i < targets.Length; i++)
|
||||||
{
|
{
|
||||||
_markers[i] = new ProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(PreInit)}"));
|
_markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(PreInit)}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -54,7 +52,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public sealed class EcsInitRunner : EcsRunner<IEcsInitSystem>, IEcsInitSystem
|
public sealed class EcsInitRunner : EcsRunner<IEcsInitSystem>, IEcsInitSystem
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
private ProfilerMarker[] _markers;
|
private EcsProfilerMarker[] _markers;
|
||||||
#endif
|
#endif
|
||||||
public void Init(EcsPipeline pipeline)
|
public void Init(EcsPipeline pipeline)
|
||||||
{
|
{
|
||||||
@ -72,10 +70,10 @@ namespace DCFApixels.DragonECS
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
protected override void OnSetup()
|
protected override void OnSetup()
|
||||||
{
|
{
|
||||||
_markers = new ProfilerMarker[targets.Length];
|
_markers = new EcsProfilerMarker[targets.Length];
|
||||||
for (int i = 0; i < targets.Length; i++)
|
for (int i = 0; i < targets.Length; i++)
|
||||||
{
|
{
|
||||||
_markers[i] = new ProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(Init)}"));
|
_markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(Init)}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -83,7 +81,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public sealed class EcsRunRunner : EcsRunner<IEcsRunSystem>, IEcsRunSystem
|
public sealed class EcsRunRunner : EcsRunner<IEcsRunSystem>, IEcsRunSystem
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
private ProfilerMarker[] _markers;
|
private EcsProfilerMarker[] _markers;
|
||||||
#endif
|
#endif
|
||||||
public void Run(EcsPipeline pipeline)
|
public void Run(EcsPipeline pipeline)
|
||||||
{
|
{
|
||||||
@ -102,10 +100,10 @@ namespace DCFApixels.DragonECS
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
protected override void OnSetup()
|
protected override void OnSetup()
|
||||||
{
|
{
|
||||||
_markers = new ProfilerMarker[targets.Length];
|
_markers = new EcsProfilerMarker[targets.Length];
|
||||||
for (int i = 0; i < targets.Length; i++)
|
for (int i = 0; i < targets.Length; i++)
|
||||||
{
|
{
|
||||||
_markers[i] = new ProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(Run)}"));
|
_markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(Run)}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -113,7 +111,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public sealed class EcsDestroyRunner : EcsRunner<IEcsDestroySystem>, IEcsDestroySystem
|
public sealed class EcsDestroyRunner : EcsRunner<IEcsDestroySystem>, IEcsDestroySystem
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
private ProfilerMarker[] _markers;
|
private EcsProfilerMarker[] _markers;
|
||||||
#endif
|
#endif
|
||||||
public void Destroy(EcsPipeline pipeline)
|
public void Destroy(EcsPipeline pipeline)
|
||||||
{
|
{
|
||||||
@ -131,10 +129,10 @@ namespace DCFApixels.DragonECS
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
protected override void OnSetup()
|
protected override void OnSetup()
|
||||||
{
|
{
|
||||||
_markers = new ProfilerMarker[targets.Length];
|
_markers = new EcsProfilerMarker[targets.Length];
|
||||||
for (int i = 0; i < targets.Length; i++)
|
for (int i = 0; i < targets.Length; i++)
|
||||||
{
|
{
|
||||||
_markers[i] = new ProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(Destroy)}"));
|
_markers[i] = new EcsProfilerMarker(EcsDebug.RegisterMark($"EcsRunner.{targets[i].GetType().Name}.{nameof(Destroy)}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,31 +5,29 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
namespace Profile
|
public readonly struct EcsProfilerMarker
|
||||||
{
|
{
|
||||||
public readonly struct ProfilerMarker
|
public readonly int id;
|
||||||
{
|
public EcsProfilerMarker(int id) => this.id = id;
|
||||||
public readonly int id;
|
public void Begin() => EcsDebug.ProfileMarkBegin(id);
|
||||||
public ProfilerMarker(int id) => this.id = id;
|
public void End() => EcsDebug.ProfileMarkEnd(id);
|
||||||
public void Begin() => EcsDebug.ProfileMarkBegin(id);
|
public AutoScope Auto() => new AutoScope(id);
|
||||||
public void End() => EcsDebug.ProfileMarkEnd(id);
|
|
||||||
public AutoScope Auto() => new AutoScope(id);
|
|
||||||
|
|
||||||
public readonly struct AutoScope : IDisposable
|
public readonly struct AutoScope : IDisposable
|
||||||
|
{
|
||||||
|
private readonly int id;
|
||||||
|
public AutoScope(int id)
|
||||||
{
|
{
|
||||||
private readonly int id;
|
this.id = id;
|
||||||
public AutoScope(int id)
|
EcsDebug.ProfileMarkBegin(id);
|
||||||
{
|
}
|
||||||
this.id = id;
|
public void Dispose()
|
||||||
EcsDebug.ProfileMarkBegin(id);
|
{
|
||||||
}
|
EcsDebug.ProfileMarkEnd(id);
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
EcsDebug.ProfileMarkEnd(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EcsDebug
|
public static class EcsDebug
|
||||||
{
|
{
|
||||||
public static void Set<T>() where T : DebugService, new() => DebugService.Set<T>();
|
public static void Set<T>() where T : DebugService, new() => DebugService.Set<T>();
|
||||||
|
Loading…
Reference in New Issue
Block a user