DelegateProfiler TotalDurationInMilliseconds Property Delta Engine Documentation

Namespace: DeltaEngine.Profiling
Assembly: DeltaEngine.Profiling (in DeltaEngine.Profiling.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public int TotalDurationInMilliseconds { get; }

Property Value

Type: Int32
Remarks

Tests: DeltaEngine.Profiling.Tests.DelegateProfilerTests
Examples

2 unit tests call DeltaEngine.Profiling.DelegateProfiler.TotalDurationInMilliseconds
[Test, Category("Slow")]
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");
}
[Test, Category("Slow")]
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");
}
See Also