void IDisposable.Dispose() { if (this.disposed) { return; } this.disposed = true; EndSample(); bool flag = this.gcCount != GC.CollectionCount(0); if (stopwatch.Elapsed.TotalMilliseconds >= this.warningMS) { UnityEngine.Debug.LogErrorFormat("TimeExecuting: <{0}> took {1:0.00} ms ({2:0} ticks){3}", new object[] { this.warningName, this.stopwatch.Elapsed.TotalMilliseconds, this.stopwatch.Elapsed.Ticks, flag ? " [GARBAGE COLLECT]" : "" }); } else { UnityEngine.Debug.LogWarningFormat("TimeExecuting: <{0}> took {1:0.00} ms ({2:0} ticks){3}", new object[] { this.warningName, this.stopwatch.Elapsed.TotalMilliseconds, this.stopwatch.Elapsed.Ticks, flag ? " [GARBAGE COLLECT]" : "" }); } TimeExecute timeWarning = this; Pool.Free <TimeExecute>(ref timeWarning); }
public static TimeExecute New(string name, int MaxMilisecond = 50) { TimeExecute timeWarning = Pool.Get <TimeExecute>(); timeWarning.Start(name, MaxMilisecond); return(timeWarning); }