示例#1
0
 public static void DumpStats(Executor executor, Solver.ISolver solver, TerminationCounter nonSpeculativeTerminationCounter,
                              TerminationCounter speculativeTerminationCounter)
 {
     using (var ITW = new System.CodeDom.Compiler.IndentedTextWriter(Console.Out))
     {
         executor.Statistics.WriteAsYAML(ITW);
         solver.Statistics.WriteAsYAML(ITW);
         solver.SolverImpl.Statistics.WriteAsYAML(ITW);
         nonSpeculativeTerminationCounter.WriteAsYAML(ITW);
         speculativeTerminationCounter.WriteAsYAML(ITW);
     }
 }
示例#2
0
        public static void SetupFileLoggers(CmdLineOpts options, Executor executor, Solver.ISolver solver)
        {
            ExecutorFileLoggerHandler executorLogger = null;

            if (options.outputDir.Length == 0)
            {
                executorLogger = new ExecutorFileLoggerHandler(executor, Directory.GetCurrentDirectory(), /*makeDirectoryInPath=*/ true);
            }
            else
            {
                executorLogger = new ExecutorFileLoggerHandler(executor, options.outputDir, /*makeDirectoryInPath=*/ false);
            }

            // Add our loggers
            executorLogger.AddRootDirLogger(new CallGrindFileLogger());
            //executorLogger.AddRootDirLogger(new MemoryUsageLogger()); // FIXME: Disable for experiments it is buggy
            executorLogger.AddRootDirLogger(new TerminationCounterLogger(TerminationCounter.CountType.ONLY_NON_SPECULATIVE));
            executorLogger.AddRootDirLogger(new TerminationCounterLogger(TerminationCounter.CountType.ONLY_SPECULATIVE));
            //executorLogger.AddRootDirLogger(new ExecutionTreeLogger(true));
            executorLogger.AddRootDirLogger(new ExecutorInfoLogger());

            Predicate <ExecutionState> statesToIgnoreFilter = delegate(ExecutionState state)
            {
                if (options.SkipLogTerminatedWithSuccess)
                {
                    if (state.TerminationType is TerminatedWithoutError)
                    {
                        return(true); // Ignore
                    }
                }

                if (options.SkipLogTerminatedWithUnsatAssume)
                {
                    if (state.TerminationType is TerminatedAtUnsatisfiableAssume)
                    {
                        return(true); // Ignore
                    }
                }

                return(false);
            };

            bool concurrentLogging = options.ConcurrentLogging > 0;

            if (options.WriteConstraints > 0)
            {
                executorLogger.AddTerminatedStateDirLogger(new ExecutionStateConstraintLogger(ExecutionStateLogger.ExecutorEventType.TERMINATED_STATE,
                                                                                              statesToIgnoreFilter, concurrentLogging));
                executorLogger.AddTerminatedStateDirLogger(new ExecutionStateUnSatCoreLogger(ExecutionStateLogger.ExecutorEventType.TERMINATED_STATE,
                                                                                             statesToIgnoreFilter, concurrentLogging));

                executorLogger.AddNonTerminatedStateDirLogger(new ExecutionStateConstraintLogger(ExecutionStateLogger.ExecutorEventType.NON_TERMINATED_STATE_REMOVED,
                                                                                                 statesToIgnoreFilter, concurrentLogging));
            }

            bool showConstraints = options.ExecutionStateInfoShowConstraints > 0;
            bool showVariables   = options.ExecutionStateInfoShowVariables > 0;

            if (options.LogTerminatedStateInfo > 0)
            {
                executorLogger.AddTerminatedStateDirLogger(new ExecutionStateInfoLogger(ExecutionStateLogger.ExecutorEventType.TERMINATED_STATE,
                                                                                        showConstraints,
                                                                                        showVariables,
                                                                                        statesToIgnoreFilter,
                                                                                        concurrentLogging));
            }
            if (options.LogNonTerminatedStateInfo > 0)
            {
                executorLogger.AddNonTerminatedStateDirLogger(new ExecutionStateInfoLogger(ExecutionStateLogger.ExecutorEventType.NON_TERMINATED_STATE_REMOVED,
                                                                                           showConstraints,
                                                                                           showVariables,
                                                                                           statesToIgnoreFilter,
                                                                                           concurrentLogging));
            }

            executorLogger.Connect();

            Console.WriteLine("Logging to directory: " + executorLogger.RootDir.FullName);
        }