/// <summary> /// Starts the benchmark. /// </summary> /// <param name="numberOfRepetitions">The number of repetitions.</param> public void StartBenchmark(int numberOfRepetitions) { this.memoryModelBenchmark = new MemoryModelBenchmark(); var builder = selectMemoryModel().Builder(); builder.Benchmark = this.memoryModelBenchmark; ModularMemoryModelFactories factories = builder.Build(); MemoryModel = factories.MemoryModelSnapshotFactory; WatchFirstPhase = new Stopwatch(); WatchSecondPhase = new Stopwatch(); RepetitionCounter = 1; initialiseAnalysisSingletons(); Watch = Stopwatch.StartNew(); try { createControlFlowGraph(); while (RepetitionCounter <= numberOfRepetitions) { clearComputation(); BenchmarkResult result = new BenchmarkResult(); benchmarkResults.Add(result); result.StartBenchmarking(); runFirstPhaseAnalysis(); runSecondPhaseAnalysis(); result.StopBenchmarking(this.memoryModelBenchmark); this.memoryModelBenchmark.ClearResults(); RepetitionCounter++; } EndState = AnalysisEndState.Success; } catch (ThreadAbortException e) { EndState = (AnalysisEndState)e.ExceptionState; } catch (Exception e) { AnalysisException = e; EndState = AnalysisEndState.Crash; } finally { Watch.Stop(); IsFinished = true; } }