mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Improved Define names
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using Beefy.utils;
|
||||
|
||||
namespace GlitchyEngine.Debug
|
||||
{
|
||||
public static class Profiler
|
||||
{
|
||||
#if !GE_PROFILE
|
||||
[SkipCall]
|
||||
#endif
|
||||
public static void BeginProfiling(StringView serverName = "127.0.0.1", StringView sessionName = "GlitchyEngine")
|
||||
{
|
||||
BeefPerf.Init(serverName, sessionName);
|
||||
}
|
||||
|
||||
#if !GE_PROFILE
|
||||
[SkipCall]
|
||||
#endif
|
||||
public static void EndProfiling()
|
||||
{
|
||||
BeefPerf.Shutdown();
|
||||
}
|
||||
|
||||
#if !GE_PROFILE
|
||||
[SkipCall]
|
||||
#endif
|
||||
public static mixin ProfileFunction()
|
||||
{
|
||||
scope:mixin PerformanceTimer()
|
||||
}
|
||||
|
||||
#if !GE_PROFILE
|
||||
[SkipCall]
|
||||
#endif
|
||||
public static mixin ProfileScope(char8* scopeName)
|
||||
{
|
||||
scope:mixin PerformanceTimer(scopeName)
|
||||
}
|
||||
}
|
||||
|
||||
class PerformanceTimer
|
||||
{
|
||||
[Inline]
|
||||
public this(char8* name = Compiler.CallerMemberName)
|
||||
{
|
||||
#if GE_PROFILE
|
||||
[Inline]
|
||||
BeefPerf.Enter(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
[Inline]
|
||||
public ~this()
|
||||
{
|
||||
#if GE_PROFILE
|
||||
[Inline]
|
||||
BeefPerf.Leave();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user