Beispiel #1
0
        public void Test()
        {
            var processor = new BenchmarkProcessor();
            var request   = new BenchmarkData();
            //request.SourceCode1 = "System.Threading.Thread.Sleep(10);";
            //request.SourceCode2 = "System.Threading.Thread.Sleep(100);";
            var response = processor.Benchmark(request);

            Assert.IsTrue(response.Success);
            //Assert.IsTrue(response.Source1Ratio > 5*response.Source2Ratio);
        }
Beispiel #2
0
        public IActionResult RunBenchmark(FormData formData)
        {
            var model = BenchmarkModel.Instance;

            for (var row = 0; row < formData.SourceCode.Length; row++)
            {
                for (var column = 0; column < formData.SourceCode[row].Length; column++)
                {
                    var sourceCode = formData.SourceCode[row][column];
                    model.BenchmarkData.SetSourceCode(row, column, sourceCode);
                }
            }

            var benchmarkProcessor = new BenchmarkProcessor();
            var response           = benchmarkProcessor.Benchmark(model.BenchmarkData);

            model.BenchmarkResponse = response;
            return(View("BenchmarkResult", model));
        }
Beispiel #3
0
        public static void RunSample()
        {
            IList<CountryOrRegionGdpData> listData = new DataImporter().Import();

            Func<BenchmarkComponentBase>[] benchmarkComponents =
            {
                () => new BenchmarkComponentKeyedCollection(listData),
                () => new BenchmarkComponentMultiplyIndexedKeyedCollection(listData),
            };

            BenchmarkProcessor benchmarkProcessor = new BenchmarkProcessor();

            BenchmarkProcessorConfiguration benchmarkProcessorConfiguration = new BenchmarkProcessorConfiguration();

            IEnumerable<IBenchmarkComponentResult> benchmarkResults = benchmarkProcessor.Execute(benchmarkProcessorConfiguration, benchmarkComponents);

            foreach (IBenchmarkComponentResult benchmarkComponentResult in benchmarkResults)
                Console.WriteLine("Benchmark Component: {0}{1}{2}", benchmarkComponentResult.Name, Environment.NewLine, FormatBenchmarkResults(benchmarkComponentResult.RootOperationResult, 0));

            Console.ReadLine();
        }
Beispiel #4
0
        public static void RunSample()
        {
            IList <CountryOrRegionGdpData> listData = new DataImporter().Import();

            Func <BenchmarkComponentBase>[] benchmarkComponents =
            {
                () => new BenchmarkComponentKeyedCollection(listData),
                () => new BenchmarkComponentMultiplyIndexedKeyedCollection(listData),
            };

            BenchmarkProcessor benchmarkProcessor = new BenchmarkProcessor();

            BenchmarkProcessorConfiguration benchmarkProcessorConfiguration = new BenchmarkProcessorConfiguration();

            IEnumerable <IBenchmarkComponentResult> benchmarkResults = benchmarkProcessor.Execute(benchmarkProcessorConfiguration, benchmarkComponents);

            foreach (IBenchmarkComponentResult benchmarkComponentResult in benchmarkResults)
            {
                Console.WriteLine("Benchmark Component: {0}{1}{2}", benchmarkComponentResult.Name, Environment.NewLine, FormatBenchmarkResults(benchmarkComponentResult.RootOperationResult, 0));
            }

            Console.ReadLine();
        }