public void CheckTotalDurationOfDoingSomethingFastAMillionTimes() { var profiler = new DelegateProfiler(DoSomeMaths, 1000000); int duration = profiler.TotalDurationInMilliseconds; Assert.IsTrue(duration > 5); Console.WriteLine(duration + " milliseconds for 1,000,000 iterations"); }
public void CheckIndividualDurationOfDoingSomethingFastAMillionTimes() { var profiler = new DelegateProfiler(DoSomeMaths, 1000000); int duration = profiler.AverageDurationInPicoseconds; Assert.IsTrue(duration > 5); Console.WriteLine(duration + " picoseconds each"); }
public void CheckTotalDurationOfDoingSomethingSlowAThousandTimes() { var profiler = new DelegateProfiler(() => Thread.Sleep(1)); int totalDuration = profiler.TotalDurationInMilliseconds; Assert.IsTrue(totalDuration > 950); Console.WriteLine(totalDuration + " milliseconds for 1,000 iterations"); }
public void CheckIndividualDurationOfDoingSomethingSlowAThousandTimes() { var profiler = new DelegateProfiler(() => Thread.Sleep(1)); int duration = profiler.AverageDurationInNanoseconds; Assert.IsTrue(duration > 950); Console.WriteLine(duration + " nanoseconds each"); }
public void DurationOfSingularFastActionIsNoticed() { var profiler = new DelegateProfiler(DoSomeMaths, 1); int duration = profiler.AverageDurationInPicoseconds; Assert.IsTrue(duration > 0); }