Beispiel #1
0
        public void Run(int iterations, Func <T, int> getProblemSize)
        {
            var result = new List <long>();

            foreach (var p in Args)
            {
                Console.WriteLine("Problem size: " + getProblemSize(p));
                for (int i = 0; i < iterations; i++)
                {
                    Clock.Restart();
                    var res = TestFunc(p);
                    Clock.Stop();
                    var time = Clock.ElapsedTicks;
                    result.Add(time);
                }

                var avg = result.Average();
                var sd  = GetStandardDeviation(result, avg);
                Results[getProblemSize(p)] = new BenchmarkResult(avg, sd);
            }
        }
Beispiel #2
0
        public void Run(int iterations)
        {
            var result = new List <long>();

            for (var j = 0; j < Problems.Length; j++)
            {
                Console.WriteLine("Problem size: " + j);
                for (var i = 0; i < iterations; i++)
                {
                    var problem = Problems[j];
                    Clock.Restart();
                    var res = TestFunc(problem);
                    Clock.Stop();
                    var time = Clock.ElapsedTicks;
                    result.Add(time);
                }

                var avg = result.Average();
                var sd  = GetStandardDeviation(result, avg);
                Results[ProblemSizes[j]] = new BenchmarkResult(avg, sd);
            }
        }