fix: Removes profiling. Streamlines core tick count. (#1948)

### Summary
- Removes `Profiling` - Recommend using Visual Studio Performance Profiler,  [dotnet-trace](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace) or [JetBrains dotTrace](https://www.jetbrains.com/profiler/)
- Cleans up the core tick count, sampling, etc.
This commit is contained in:
Kamron Batman 2024-09-11 00:55:18 -07:00 • committed by GitHub
parent 65bc264402
commit 2e6ddcd31a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 80 additions and 949 deletions

View file

@ -136,9 +136,6 @@ public partial class Timer
{
var finished = timer.Count != 0 && timer.Index + 1 >= timer.Count;
var prof = timer.GetProfile();
prof?.Start();
// Stop the timer from running so that way if Start() is called in OnTick, the timer will be started.
if (finished)
{
@ -149,7 +146,6 @@ public partial class Timer
var version = timer.Version;
timer.OnTick();
prof?.Finish();
// Starting doesn't change the timer version, so we need to check if it's finished and if it's still running.
if (timer.Version != version || finished && timer.Running)

View file

@ -15,7 +15,6 @@
using System;
using System.Diagnostics;
using Server.Diagnostics;
using Server.Logging;
namespace Server;
@ -54,13 +53,6 @@ public partial class Timer
Next = Core.Now + Delay;
_ring = -1;
_slot = -1;
var prof = GetProfile();
if (prof != null)
{
prof.Created++;
}
}
protected int Version { get; set; } // Used to determine if a timer was altered and we should abandon it.
@ -73,8 +65,6 @@ public partial class Timer
public int RemainingCount => Count == 0 ? int.MaxValue : Count - Index;
public bool Running { get; private set; }
public TimerProfile GetProfile() => !Core.Profiling ? null : TimerProfile.Acquire(ToString() ?? "null");
public override string ToString() => GetType().FullName;
public Timer Start()
@ -111,13 +101,6 @@ public partial class Timer
Running = true;
AddTimer(this, (long)Delay.TotalMilliseconds);
var prof = GetProfile();
if (prof != null)
{
prof.Started++;
}
return this;
}
@ -174,12 +157,6 @@ public partial class Timer
{
_executingRings[_ring] = _nextTimer;
}
var prof = GetProfile();
if (prof != null)
{
prof.Stopped++;
}
}
protected virtual void OnTick()