private void PrintResult(IPaulTest test, Stopwatch stopwatch)
 {
     if (results == Results.Total_time)
     {
         Console.WriteLine(" Hey {0,-20} - you did it in {1,10}", test.GetType().Name, stopwatch.Elapsed);
     }
     else
     {
         Console.WriteLine(" Hey {0,-20} - you did {1,10} operations per second", test.GetType().Name,
                           (iterations * oneSecondTicks) / stopwatch.Elapsed.Ticks);
     }
 }
Ejemplo n.º 2
0
        private long RunWithStop(IPaulTest test)
        {
            Console.WriteLine(" Testing {0,-20}", test.GetType().Name);
            var count = 0;

            for (var i = 0; i < iterations; i++)
            {
                count++;
                var player = test.ResolvePlayer();
                player.Shoot();
                if (count == memorySnapshotStep)
                {
                    CollectSnapshot(i);
                    count = 0;
                }
            }
            PrintResult(test);
            var disposable = test as IDisposable;

            if (disposable != null)
            {
                disposable.Dispose();
            }
            return(0);
        }
Ejemplo n.º 3
0
 private static bool ShouldRun(Regex filter, IPaulTest paulTest)
 {
     if (filter == null) return true;
     var name = paulTest.GetType().Name;
     var shouldRun = filter.IsMatch(name);
     return shouldRun;
 }
Ejemplo n.º 4
0
        private static bool ShouldRun(Regex filter, IPaulTest paulTest)
        {
            if (filter == null)
            {
                return(true);
            }
            var name      = paulTest.GetType().Name;
            var shouldRun = filter.IsMatch(name);

            return(shouldRun);
        }
 private void PrintResult(IPaulTest test, Stopwatch stopwatch)
 {
     if (results == Results.Total_time)
     {
         Console.WriteLine(" Hey {0,-20} - you did it in {1,10}", test.GetType().Name, stopwatch.Elapsed);
     }
     else
     {
         Console.WriteLine(" Hey {0,-20} - you did {1,10} operations per second", test.GetType().Name,
                           (iterations * oneSecondTicks) / stopwatch.Elapsed.Ticks);
     }
 }
 private long RunContinuously(IPaulTest test)
 {
     Console.WriteLine(" Testing {0,-20}", test.GetType().Name);
     for (var i = 0; i < iterations; i++)
     {
         var player = test.ResolvePlayer();
         player.Shoot();
     }
     PrintResult(test);
     var disposable = test as IDisposable;
     if (disposable != null)
     {
         disposable.Dispose();
     }
     return 0;
 }
Ejemplo n.º 7
0
        private long RunContinuously(IPaulTest test)
        {
            Console.WriteLine(" Testing {0,-20}", test.GetType().Name);
            for (var i = 0; i < iterations; i++)
            {
                var player = test.ResolvePlayer();
                player.Shoot();
            }
            PrintResult(test);
            var disposable = test as IDisposable;

            if (disposable != null)
            {
                disposable.Dispose();
            }
            return(0);
        }
 private long RunWithStop(IPaulTest test)
 {
     Console.WriteLine(" Testing {0,-20}", test.GetType().Name);
     var count = 0;
     for (var i = 0; i < iterations; i++)
     {
         count++;
         var player = test.ResolvePlayer();
         player.Shoot();
         if(count ==memorySnapshotStep)
         {
             CollectSnapshot(i);
             count = 0;
         }
     }
     PrintResult(test);
     var disposable = test as IDisposable;
     if (disposable != null)
     {
         disposable.Dispose();
     }
     return 0;
 }
 private void PrintResult(IPaulTest test)
 {
     Console.WriteLine(" Hey {0,-20} - you're done. Collect snapshot and proceed with enter", test.GetType().Name);
     Console.ReadLine();
 }
Ejemplo n.º 10
0
 private void PrintResult(IPaulTest test)
 {
     Console.WriteLine(" Hey {0,-20} - you're done. Collect snapshot and proceed with enter", test.GetType().Name);
     Console.ReadLine();
 }