public void Bench(BenchCallback callback) { PastASecond = false; if (SW == null) SW = Stopwatch.StartNew(); callback(); speed++; if (SW.ElapsedMilliseconds >= 1000) { SpeedPerSec = speed; speed = 0; SW = Stopwatch.StartNew(); PastASecond = true; } }
public void Bench(BenchCallback callback) { PastASecond = false; if (SW == null) { SW = Stopwatch.StartNew(); } callback(); speed++; if (SW.ElapsedMilliseconds >= 1000) { SpeedPerSec = speed; speed = 0; SW = Stopwatch.StartNew(); PastASecond = true; } }