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); }
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)); }
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(); }
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(); }