コード例 #1
0
        /// <summary>
        /// Starts the analysis.
        /// </summary>
        public void StartAnalysis()
        {
            this.memoryModelBenchmark = null;

            MemoryModel = selectMemoryModel().MemoryModelSnapshotFactory;

            WatchFirstPhase  = new Stopwatch();
            WatchSecondPhase = new Stopwatch();

            Watch = Stopwatch.StartNew();
            try
            {
                createControlFlowGraph();
                clearComputation();

                runFirstPhaseAnalysis();
                runSecondPhaseAnalysis();

                EndState = AnalysisEndState.Success;
            }
            catch (ThreadAbortException e)
            {
                EndState = (AnalysisEndState)e.ExceptionState;
            }
            catch (Exception e)
            {
                AnalysisException = e;
                EndState          = AnalysisEndState.Crash;
            }
            finally
            {
                Watch.Stop();
                IsFinished = true;
            }
        }
コード例 #2
0
        /// <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;
            }
        }