public void MeasureIndirectStartStopWithUnderplayAndOverplay02() { var p1 = new Startwatch(); Startwatch measure = p1.CreateSibling(); var c2 = measure.CreateChild(); var c3 = c2.CreateLastSibling(measure); Stopwatch assertComparisonTimer = null; var loopTimer = Stopwatch.StartNew(); while (loopTimer.ElapsedTicks < 3 * Stopwatch.Frequency) { if (assertComparisonTimer == null && loopTimer.ElapsedTicks > Stopwatch.Frequency) { p1.Stop(); assertComparisonTimer = Stopwatch.StartNew(); c2.Stop(); } else if (loopTimer.ElapsedTicks > 2 * Stopwatch.Frequency) { assertComparisonTimer.Stop(); c3.Stop(); } } AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void IsActiveOnInactiveStopwatch() { var watch = new Startwatch(); watch.Stop(); Assert.IsFalse(watch.IsActive, "Stopwatch active property"); }
public void StartTimeAfterStopping() { var stopwatch = new Startwatch(); var dateTime = DateTime.Now; stopwatch.Stop(); AssertDatesSimilar(dateTime, stopwatch.StartTime); }
public void EndTimeWithStopping() { var stopwatch = new Startwatch(); Thread.Sleep(10); stopwatch.Stop(); var dateTime = DateTime.Now; AssertDatesSimilar(dateTime, stopwatch.EndTime); }
public void Test001() { var log = GetLogger(); Startwatch timer = new Startwatch(); log.PerfEvent_Initialize(); timer.Stop(); WasteTime(); Assert.IsFalse(log.PerfEvent_GetSetupTime().TimeData.IsActive, "SEtup timer should not be running"); AssertStopwatch(timer, log.PerfEvent_GetSetupTime().TimeData); }
public void MeasureStandard() { Startwatch measure = new Startwatch(); var assertComparisonTimer = Stopwatch.StartNew(); var loopTimer = Stopwatch.StartNew(); while (loopTimer.ElapsedTicks < Stopwatch.Frequency) { ; } measure.Stop(); assertComparisonTimer.Stop(); AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void MeasureChild() { var assertComparisonTimer = Stopwatch.StartNew(); var parent = new Startwatch(); Startwatch measure = parent.CreateChild(); var loopTimer = Stopwatch.StartNew(); while (loopTimer.ElapsedTicks < Stopwatch.Frequency) { ; } measure.Stop(); assertComparisonTimer.Stop(); AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void MeasureActiveStopwatchConstruction() { var assertComparisonTimer = Stopwatch.StartNew(); Startwatch measure = Startwatch.FromStopwatch(assertComparisonTimer); var loopTimer = Stopwatch.StartNew(); while (loopTimer.ElapsedTicks < Stopwatch.Frequency) { ; } assertComparisonTimer.Stop(); measure.Stop(); AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
private void bntStart_Click(object sender, EventArgs e) { if (bntStart.Text == "START") { bntStart.Text = "PAUSE"; Startwatch.Start(); watch.Start(); } else { bntStart.Text = "START"; Startwatch.Stop(); watch.Stop(); } }
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) { measure.Stop(); assertComparisonTimer.Stop(); } } AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void MeasureActiveStopwatchConstructionWithOverplay() { var assertComparisonTimer = Stopwatch.StartNew(); Startwatch measure = Startwatch.FromStopwatch(assertComparisonTimer); var loopTimer = Stopwatch.StartNew(); while (loopTimer.ElapsedTicks < 2 * Stopwatch.Frequency) { if (loopTimer.ElapsedTicks > Stopwatch.Frequency) { assertComparisonTimer.Stop(); measure.Stop(); } } AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void Test002() { var log = GetLogger(); log.PerfEvent_Initialize(); Startwatch timer = new Startwatch(); WasteTime(); Assert.IsTrue(log.PerfEvent_GetBeforeFirstEventTime().TimeData.IsActive, "First event timer should be running"); log.PerfEvent_NewEventAudit(_lt); timer.Stop(); WasteTime(); Assert.IsFalse(log.PerfEvent_GetBeforeFirstEventTime().TimeData.IsActive, "Before first event timer should not be runing"); AssertStopwatch(timer, log.PerfEvent_GetBeforeFirstEventTime().TimeData); }
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(); while (loopTimer.ElapsedTicks < Stopwatch.Frequency) { ; } measure.Stop(); assertComparisonTimer.Stop(); AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void MeasureSiblingWithOverplay() { var first = new Startwatch(); Startwatch measure = first.CreateSibling(); var assertComparisonTimer = Stopwatch.StartNew(); first.Stop(); var loopTimer = Stopwatch.StartNew(); while (loopTimer.ElapsedTicks < 2 * Stopwatch.Frequency) { if (loopTimer.ElapsedTicks > Stopwatch.Frequency) { measure.Stop(); assertComparisonTimer.Stop(); } } AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void MeasureSibling() { var first = new Startwatch(); Startwatch measure = first.CreateSibling(); var assertComparisonTimer = Stopwatch.StartNew(); first.Stop(); var loopTimer = Stopwatch.StartNew(); using (measure.CreateController()) { while (loopTimer.ElapsedTicks < Stopwatch.Frequency) { ; } } assertComparisonTimer.Stop(); AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void MeasureSiblingWithOverplay() { var first = new Startwatch(); Startwatch measure = first.CreateSibling(); var assertComparisonTimer = Stopwatch.StartNew(); first.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); }
public void MeasureLastSiblingWithOverplay() { 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) { // checking first.stop() stops measure first.Stop(); assertComparisonTimer.Stop(); } } AssertStopwatch(assertComparisonTimer.ElapsedTicks, measure); }
public void Test004() { var log = GetLogger(); log.PerfEvent_Initialize(); Assert.IsFalse(log.PerfEvent_GetRunningTotal().TimeData.IsActive, "Running total timer should not have started yet"); WasteTime(); Startwatch timer = new Startwatch(); log.PerfEvent_NewEventAudit(_lt); Assert.IsTrue(log.PerfEvent_GetRunningTotal().TimeData.IsActive, "Total timer should have started"); WasteTime(); Assert.IsTrue(log.PerfEvent_GetRunningTotal().TimeData.IsActive, "Total timer should have started"); log.PerfEvent_CompleteEverything(); timer.Stop(); WasteTime(); Assert.IsFalse(log.PerfEvent_GetRunningTotal().TimeData.IsActive, "Running total timer should have finished"); AssertStopwatch(timer, log.PerfEvent_GetRunningTotal().TimeData); }