コード例 #1
0
        /// <summary>
        ///   Generates a <see cref="StateGraph{TExecutableModel}" /> for the model created by <paramref name="createModel" />.
        /// </summary>
        internal StateGraph <TExecutableModel> GenerateStateGraph()
        {
            // We have to track the state vector layout here; this will nondeterministically store some model instance of
            // one of the workers; but since all state vectors are the same, we don't care
            ExecutedModel <TExecutableModel> model = null;
            Func <AnalysisModel>             createAnalysisModelFunc = () =>
                                                                       model = new ActivationMinimalExecutedModel <TExecutableModel>(ModelCreator, 0, Configuration);
            var createAnalysisModel = new AnalysisModelCreator(createAnalysisModelFunc);

            using (var checker = new StateGraphGenerator <TExecutableModel>(createAnalysisModel, Configuration))
            {
                var stateGraph = checker.GenerateStateGraph();
                return(stateGraph);
            }
        }
コード例 #2
0
ファイル: SSharpChecker.cs プロジェクト: isse-augsburg/ssharp
		/// <summary>
		///   Generates a <see cref="StateGraph" /> for the model created by <paramref name="createModel" />.
		/// </summary>
		internal StateGraph GenerateStateGraph(Func<AnalysisModel> createModel, Formula[] stateFormulas)
		{
			Requires.That(IntPtr.Size == 8, "State graph generation is only supported in 64bit processes.");

			var stopwatch = new Stopwatch();
			stopwatch.Start();

			using (var checker = new StateGraphGenerator(createModel, stateFormulas, OutputWritten, Configuration))
			{
				var stateGraph = default(StateGraph);
				var initializationTime = stopwatch.Elapsed;
				stopwatch.Restart();

				try
				{
					stateGraph = checker.GenerateStateGraph();
					return stateGraph;
				}
				finally
				{
					stopwatch.Stop();

					if (!Configuration.ProgressReportsOnly)
					{
						OutputWritten?.Invoke(String.Empty);
						OutputWritten?.Invoke("===============================================");
						OutputWritten?.Invoke($"Initialization time: {initializationTime}");
						OutputWritten?.Invoke($"State graph generation time: {stopwatch.Elapsed}");

						if (stateGraph != null)
						{
							OutputWritten?.Invoke($"{(int)(stateGraph.StateCount / stopwatch.Elapsed.TotalSeconds):n0} states per second");
							OutputWritten?.Invoke($"{(int)(stateGraph.TransitionCount / stopwatch.Elapsed.TotalSeconds):n0} transitions per second");
						}

						OutputWritten?.Invoke("===============================================");
						OutputWritten?.Invoke(String.Empty);
					}
				}
			}
		}