コード例 #1
0
 public static void EndSample()
 {
     if (TimeWarning.OnEnd != null)
     {
         TimeWarning.OnEnd();
     }
 }
コード例 #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 };
            TimeSpan elapsed      = this.stopwatch.Elapsed;
            totalSeconds[1] = elapsed.TotalSeconds;
            elapsed         = this.stopwatch.Elapsed;
            totalSeconds[2] = elapsed.TotalMilliseconds;
            totalSeconds[3] = (flag ? " [GARBAGE COLLECT]" : "");
            UnityEngine.Debug.LogWarningFormat("TimeWarning: {0} took {1:0.00} seconds ({2:0} ms){3}", totalSeconds);
        }
        TimeWarning timeWarning = this;

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