static void Main(string[] args) { Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us"); var testCount = 10; //var conn = new CouchbaseConnector(); //conn.Connect(); //conn.Insert(RedditModel.GetDemo()); var cluster = RiakCluster.FromConfig("riakConfig"); //IRiakClient client = cluster.CreateClient(); //var a = client.Ping(); var benchmarks = new BenchmarkFactory().GetAllBenchmarks(ModelDataType.Reddit); foreach (var benchmark in benchmarks) { var stopwatch = new Stopwatch(); stopwatch.Start(); //Console.Write($"\r{i * 100 / testCount}%\t"); benchmark.Test <RedditModel>(new JustInsertsStrategy() { CountOfOperations = testCount }); stopwatch.Stop(); Console.WriteLine($"{benchmark,9} resulted with {stopwatch.Elapsed:g}"); benchmark.Dispose(); } Console.ReadKey(); }
public void Warmup(IContainerAdapter container) { container.Prepare(); var benchmarks = BenchmarkFactory.CreateBenchmarks().ToArray(); // Run each benchmark before start measuring to ensure that all root services has been resolved. // Exclude the "Prepare" benchmarks as they dispose the container. foreach (var benchmark in benchmarks.Where(b => !b.Name.StartsWith("Prepare"))) { if (benchmark.IsSupportedBy(container)) { benchmark.Warmup(container); } } }
private static void Main(string[] args) { #if DEBUG args = new[] { "m", "c", "500000", "r" }; #else if(args == null || args.Length==0) { ShowHelp(); return; } #endif using (var benchmark = new BenchmarkFactory(args).Create()) { benchmark.Run(); } }
private async void startBenchmarkButton_Click(object sender, EventArgs e) { var benchmark = BenchmarkFactory.Create(); var dateTime = DateTime.Now; lastBenchmarkTimeLabel.Text = "Benchmarking..."; lastBenchmarkRunLabel.Text = dateTime.ToString(Thread.CurrentThread.CurrentCulture); mainPanel.Enabled = false; try { var result = await benchmark.Start().ConfigureAwait(false); var runtime = result.FrameRenderingDuration; WriteBenchmarkResult(dateTime, runtime); } finally { mainPanel.Enabled = true; } }
static void Main(string[] args) { var param = new Params() { use_base_lemmas = false, use_extended_lemmas = true, find_groundTruth = true, random = false, printConsole = true }; var rand = new Random(2); var program = new Program(rand); program.TestRun(); Console.WriteLine("Enter options below:"); Console.WriteLine("1- "); Console.WriteLine("2- "); var option = Console.ReadLine(); if (option == "1") { program.Synthesize_WhileTrue(param); } else if (option == "1d") { param.debug = true; program.Synthesize_WhileTrue(param); } else if (option == "2") { BenchmarkFactory.CreateBenchmark(rand, 1); } }
public static IEngine GetEngine(ExperimentParameters experimentParameters) { IEngine engine; //BasePopulation Solution[] basePopulation = new Solution[experimentParameters.BasePopulationSize]; Solution[] offspringPopulation = new Solution[experimentParameters.OffspringPopulationSize]; IBenchmark benchmark = BenchmarkFactory.GetBenchmark(experimentParameters); IPopulationGenerator populationGenerator = PopulationGeneratorsFactory.GetPopulationGenerator(experimentParameters); //Points generators //var domain = new Domain2(experimentParameters); //IPointsGenerator positivePointsGenerator = new PositivePointsGenerator(); //var positivePoints = // positivePointsGenerator.GeneratePoints(experimentParameters.NumberOfPositivePoints, benchmark); //IPointsGenerator negativePointsGenerator = new NegativePointsGenerator(positivePoints, new CanberraDistanceCalculator()); ////Evaluator //var negativePoints = // negativePointsGenerator.GeneratePoints(experimentParameters.NumberOfNegativePoints, benchmark); //IEvaluator evaluator = new Evaluator(experimentParameters, positivePoints, negativePoints); IEvaluator evaluator = new Evaluator(experimentParameters); //Redundant constraints remover var redundantConstraintsRemover = new RedundantConstraintsRemover(new DomainSpaceSampler(), benchmark, experimentParameters); //Statistics var statistics = new Statistics(); //Logger ILogger logger = null; //Selectors var parentsSelector = SelectorsFactory.GetParentsSelector(experimentParameters); var survivorsSelector = SelectorsFactory.GetSurvivorsSelector(experimentParameters); //Mutation var objectMutator = MutatorsFactory.GetObjectMutator(experimentParameters); var stdDeviationsMutator = MutatorsFactory.GetStdDevsMutator(experimentParameters); var mutationRuleSupervisor = MutationSupervisorsFactory.GetMutationRuleSupervisor(experimentParameters); if (experimentParameters.TypeOfMutation == ExperimentParameters.MutationType.Correlated) { if (experimentParameters.UseRecombination) { var objectRecombiner = RecombinersFactory.GetObjectRecombiner(experimentParameters); var stdDevsRecombiner = RecombinersFactory.GetStdDevsRecombiner(experimentParameters); var rotationsRecombiner = RecombinersFactory.GetRotationsRecombiner(experimentParameters); var rotationsMutator = MutatorsFactory.GetRotationsMutator(experimentParameters); //engine = new CmEngineWithRecombination(benchmark, populationGenerator, evaluator, logger, objectMutator, stdDeviationsMutator, mutationRuleSupervisor, parentsSelector, survivorsSelector, positivePointsGenerator, negativePointsGenerator, experimentParameters, basePopulation, offspringPopulation, objectRecombiner, stdDevsRecombiner, rotationsMutator, rotationsRecombiner); engine = new CmEngineWithRecombination(benchmark, populationGenerator, evaluator, logger, objectMutator, stdDeviationsMutator, mutationRuleSupervisor, parentsSelector, survivorsSelector, redundantConstraintsRemover, experimentParameters, statistics, basePopulation, offspringPopulation, objectRecombiner, stdDevsRecombiner, rotationsMutator, rotationsRecombiner); } else { var rotationsMutator = MutatorsFactory.GetRotationsMutator(experimentParameters); //engine = new CmEngineWithoutRecombination(benchmark, populationGenerator, evaluator, logger, objectMutator, stdDeviationsMutator, mutationRuleSupervisor, parentsSelector, survivorsSelector, positivePointsGenerator, negativePointsGenerator, experimentParameters, basePopulation, offspringPopulation, rotationsMutator); engine = new CmEngineWithoutRecombination(benchmark, populationGenerator, evaluator, logger, objectMutator, stdDeviationsMutator, mutationRuleSupervisor, parentsSelector, survivorsSelector, redundantConstraintsRemover, experimentParameters, statistics, basePopulation, offspringPopulation, rotationsMutator); } } else { if (experimentParameters.UseRecombination) { var objectRecombiner = RecombinersFactory.GetObjectRecombiner(experimentParameters); var stdDevsRecombiner = RecombinersFactory.GetStdDevsRecombiner(experimentParameters); //engine = new UmEngineWithRecombination(benchmark, populationGenerator, evaluator, logger, objectMutator, stdDeviationsMutator, mutationRuleSupervisor, parentsSelector, survivorsSelector, positivePointsGenerator, negativePointsGenerator, experimentParameters, basePopulation, offspringPopulation, objectRecombiner, stdDevsRecombiner); engine = new UmEngineWithRecombination(benchmark, populationGenerator, evaluator, logger, objectMutator, stdDeviationsMutator, mutationRuleSupervisor, parentsSelector, survivorsSelector, redundantConstraintsRemover, experimentParameters, statistics, basePopulation, offspringPopulation, objectRecombiner, stdDevsRecombiner); } else { //engine = new UmEngineWithoutRecombination(benchmark, populationGenerator, evaluator, logger, objectMutator, stdDeviationsMutator, mutationRuleSupervisor, parentsSelector, survivorsSelector, positivePointsGenerator, negativePointsGenerator, experimentParameters, basePopulation, offspringPopulation); engine = new UmEngineWithoutRecombination(benchmark, populationGenerator, evaluator, logger, objectMutator, stdDeviationsMutator, mutationRuleSupervisor, parentsSelector, survivorsSelector, redundantConstraintsRemover, experimentParameters, statistics, basePopulation, offspringPopulation); } } return(engine); }