Exemple #1
0
 public static void EndSample()
 {
     if (TimeWarning.OnEnd != null)
     {
         TimeWarning.OnEnd();
     }
 }
Exemple #2
0
        void System.IDisposable.Dispose()
        {
            if (this.disposed)
            {
                return;
            }
            this.disposed = true;
            if (TimeWarning.OnEnd != null)
            {
                TimeWarning.OnEnd();
            }
            if (TimeWarning.Enabled && this.stopwatch.Elapsed.TotalMilliseconds > this.warningMS)
            {
                bool     flag         = this.gcCount != GC.CollectionCount(0);
                object[] totalSeconds = new object[] { this.warningName, null, null, null };
                totalSeconds[1] = this.stopwatch.Elapsed.TotalSeconds;
                totalSeconds[2] = this.stopwatch.Elapsed.TotalMilliseconds;
                totalSeconds[3] = (!flag ? string.Empty : " [GARBAGE COLLECT]");
                ConsoleSystem.LogWarning(String.Format("TimeWarning: {0} took {1:0.00} seconds ({2:0} ms){3}", totalSeconds));
            }
            TimeWarning timeWarning = this;

            Pool.Free <TimeWarning>(ref timeWarning);
        }