コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }