示例#1
0
        /// <summary>
        /// Analyzes the given P# project.
        /// </summary>
        /// <param name="project">Project</param>
        private void AnalyzeProject(Project project)
        {
            // Starts profiling the analysis.
            if (this.CompilationContext.Configuration.ShowRuntimeResults)
            {
                Profiler.StartMeasuringExecutionTime();
            }

            // Create a P# static analysis context.
            var context = AnalysisContext.Create(this.CompilationContext.Configuration, project);

            // Creates and runs an analysis that performs an initial sanity
            // checking to see if machine code behaves as it should.
            SanityCheckingAnalysis.Create(context).Run();

            // Creates and runs an analysis that finds if a machine exposes
            // any fields or methods to other machines.
            RuntimeOnlyDirectAccessAnalysis.Create(context).Run();

            // Creates and runs an analysis that computes the summary
            // for every method in each machine.
            var methodSummaryAnalysis = MethodSummaryAnalysis.Create(context);

            methodSummaryAnalysis.Run();
            if (this.CompilationContext.Configuration.ShowGivesUpInformation)
            {
                methodSummaryAnalysis.PrintGivesUpResults();
            }

            // Creates and runs an analysis that constructs the
            // state transition graph for each machine.
            if (this.CompilationContext.Configuration.DoStateTransitionAnalysis)
            {
                StateTransitionAnalysis.Create(context).Run();
            }

            // Creates and runs an analysis that detects if all methods
            // in each machine respect given up ownerships.
            RespectsOwnershipAnalysis.Create(context).Run();

            // Stops profiling the analysis.
            if (this.CompilationContext.Configuration.ShowRuntimeResults)
            {
                Profiler.StopMeasuringExecutionTime();
            }

            if (this.CompilationContext.Configuration.ShowRuntimeResults ||
                this.CompilationContext.Configuration.ShowDFARuntimeResults ||
                this.CompilationContext.Configuration.ShowROARuntimeResults)
            {
                Profiler.PrintResults();
            }
        }
示例#2
0
        /// <summary>
        /// Analyse the given P# project.
        /// </summary>
        /// <param name="project">Project</param>
        private static void AnalyseProgramUnit(Project project)
        {
            // Starts profiling the analysis.
            if (Configuration.ShowRuntimeResults)
            {
                Profiler.StartMeasuringExecutionTime();
            }

            // Create a P# analysis context.
            AnalysisContext.Create(project);

            // Runs an analysis that performs an initial sanity checking
            // to see if machine code behaves as it should.
            SanityCheckingAnalysis.Run();

            // Runs an analysis that finds if a machine exposes any fields
            // or methods to other machines.
            RuntimeOnlyDirectAccessAnalysis.Run();

            // Runs an analysis that computes the summary for every
            // method in each machine.
            MethodSummaryAnalysis.Run();
            if (Configuration.ShowGivesUpInformation)
            {
                MethodSummaryAnalysis.PrintGivesUpResults();
            }

            // Runs an analysis that constructs the state transition graph
            // for each machine.
            if (Configuration.DoStateTransitionAnalysis)
            {
                StateTransitionAnalysis.Run();
            }

            // Runs an analysis that detects if all methods in each machine
            // respect given up ownerships.
            RespectsOwnershipAnalysis.Run();

            // Stops profiling the analysis.
            if (Configuration.ShowRuntimeResults)
            {
                Profiler.StopMeasuringExecutionTime();
            }

            Profiler.PrintResults();
        }