Пример #1
0
 public Measure(TimeSpan totalProcessorTime, TimeSpan wallClockTime, double peakMemorySizeMB, LimitsStatus limits)
 {
     TotalProcessorTime = totalProcessorTime;
     WallClockTime      = wallClockTime;
     PeakMemorySizeMB   = peakMemorySizeMB;
     Limits             = limits;
 }
Пример #2
0
        public override ProcessRunAnalysis Analyze(string inputFile, ProcessRunMeasure measure)
        {
            if (!measure.StdOut.CanSeek)
            {
                throw new NotSupportedException("Standard output stream doesn't support seeking");
            }
            if (!measure.StdErr.CanSeek)
            {
                throw new NotSupportedException("Standard error stream doesn't support seeking");
            }
            measure.StdOut.Position = 0L;
            measure.StdErr.Position = 0L;

            Counts countsTargets;

            try
            {
                using (Stream input = new FileStream(inputFile, FileMode.Open, FileAccess.Read))
                {
                    countsTargets = CountInput(input);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Failed to read input file: " + ex);
                countsTargets = new Counts();
            }
            Counts countsResults = CountResults(measure.StdOut);

            int?         exitCode = measure.ExitCode;
            LimitsStatus limits   = measure.Limits;
            ResultStatus status;

            if (limits == LimitsStatus.TimeOut)
            {
                status = ResultStatus.Timeout;
            }
            else if (limits == LimitsStatus.MemoryOut || exitCode == 101)
            {
                status = ResultStatus.OutOfMemory;
            }
            else if (exitCode == 0)
            {
                if (countsResults.sat == 0 && countsResults.unsat == 0 && countsResults.other == 0)
                {
                    status = ResultStatus.Error;
                }
                else
                {
                    status = ResultStatus.Success;
                }
            }
            else
            {
                status = GetBugCode(measure);
            }

            return(new ProcessRunAnalysis(status,
                                          new Dictionary <string, string>
            {
                { KeySat, countsResults.sat.ToString() },
                { KeyUnsat, countsResults.unsat.ToString() },
                { KeyUnknown, countsResults.other.ToString() },

                { KeyTargetSat, countsTargets.sat.ToString() },
                { KeyTargetUnsat, countsTargets.unsat.ToString() },
                { KeyTargetUnknown, countsTargets.other.ToString() }
            }));
        }
Пример #3
0
 public ProcessRunMeasure(TimeSpan totalProcessorTime, TimeSpan wallClockTime, double peakMemorySizeMB, LimitsStatus status, int?exitCode, Stream stdOut, Stream stdErr) :
     base(totalProcessorTime, wallClockTime, peakMemorySizeMB, status)
 {
     ExitCode = exitCode;
     StdOut   = stdOut;
     StdErr   = stdErr;
 }