private TimeSpan NextElapsed() { return (ElapsedTimes.MoveNext() ? ElapsedTimes.Current : throw new InvalidOperationException("You did not define enough timestamps.")); }
public void Run(Action func) { List <Task> tasks = new List <Task>(); for (int i = 0; i < Repeat; i++) { tasks.Add(new Task( () => { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); func(); sw.Stop(); lock (ElapsedTimes) { ElapsedTimes.Add(sw.ElapsedMilliseconds); } })); tasks.Last().Start(); } tasks.ForEach(task => task.Wait()); }
public void Dispose() { ElapsedTimes.Dispose(); }
public void Reset() { ElapsedTimes.Reset(); ElapsedTimes.MoveNext(); }