public void MeasureStandard() { Startwatch measure = new Startwatch(); var assertComparisonTimer = Stopwatch.StartNew(); var loopTimer = Stopwatch.StartNew(); using (measure.CreateController()) { while (loopTimer.ElapsedTicks < Stopwatch.Frequency) { ; } } assertComparisonTimer.Stop(); AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void MeasureStandardWithOverplay() { Startwatch measure = new Startwatch(); var assertComparisonTimer = Stopwatch.StartNew(); var loopTimer = Stopwatch.StartNew(); while (loopTimer.ElapsedTicks < 2 * Stopwatch.Frequency) { if (loopTimer.ElapsedTicks > Stopwatch.Frequency) { using (measure.CreateController()) {} // this is kind of contrived... assertComparisonTimer.Stop(); } } AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void MeasureLastSibling01() { var first = new Startwatch(); var second = first.CreateChild(); Startwatch measure = second.CreateLastSibling(first); var assertComparisonTimer = Stopwatch.StartNew(); second.Stop(); var loopTimer = Stopwatch.StartNew(); using (measure.CreateController()) { while (loopTimer.ElapsedTicks < Stopwatch.Frequency) { ; } } assertComparisonTimer.Stop(); AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void MeasureLastSiblingWithOverplay01() { var first = new Startwatch(); var second = first.CreateChild(); Startwatch measure = second.CreateLastSibling(first); var assertComparisonTimer = Stopwatch.StartNew(); second.Stop(); var loopTimer = Stopwatch.StartNew(); while (loopTimer.ElapsedTicks < 2 * Stopwatch.Frequency) { if (loopTimer.ElapsedTicks > Stopwatch.Frequency) { using (measure.CreateController()) {} // this is kind of contrived... assertComparisonTimer.Stop(); } } AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }