Пример #1
0
        public static ChartData BuildChartDataForMethodCall(
            IBenchmark benchmark, int repetitionsCount)
        {
            var classesTimes    = new List <ExperimentResult>();
            var structuresTimes = new List <ExperimentResult>();

            foreach (var size in Constants.FieldCounts)
            {
                var methodCallClass  = new MethodCallWithClassArgumentTask(size);
                var methodCallStruct = new MethodCallWithStructArgumentTask(size);

                var classTime  = benchmark.MeasureDurationInMs(methodCallClass, repetitionsCount);
                var structTime = benchmark.MeasureDurationInMs(methodCallStruct, repetitionsCount);

                classesTimes.Add(new ExperimentResult(size, classTime));
                structuresTimes.Add(new ExperimentResult(size, structTime));
            }

            return(new ChartData
            {
                Title = "Call method with argument",
                ClassPoints = classesTimes,
                StructPoints = structuresTimes,
            });
        }
 public CompariableMethods(int size, bool isMethodCaller)
 {
     if (isMethodCaller)
     {
         Classes    = new MethodCallWithClassArgumentTask(size);
         Structures = new MethodCallWithStructArgumentTask(size);
     }
     else
     {
         Classes    = new ClassArrayCreationTask(size);
         Structures = new StructArrayCreationTask(size);
     }
 }