Пример #1
0
        private ExecuteResult Execute(Process process, Benchmark benchmark, SynchronousProcessOutputLoggerWithDiagnoser loggerWithDiagnoser,
                                      IDiagnoser compositeDiagnoser, ILogger logger)
        {
            consoleHandler.SetProcess(process);

            process.Start();

            compositeDiagnoser?.ProcessStarted(process);

            process.EnsureHighPriority(logger);
            if (!benchmark.Job.Env.Affinity.IsDefault)
            {
                process.EnsureProcessorAffinity(benchmark.Job.Env.Affinity.SpecifiedValue);
            }

            loggerWithDiagnoser.ProcessInput();

            process.WaitForExit(); // should we add timeout here?

            compositeDiagnoser?.ProcessStopped(process);

            if (process.ExitCode == 0)
            {
                return(new ExecuteResult(true, process.ExitCode, loggerWithDiagnoser.LinesWithResults, loggerWithDiagnoser.LinesWithExtraOutput));
            }

            return(new ExecuteResult(true, process.ExitCode, new string[0], new string[0]));
        }
Пример #2
0
        private ExecuteResult Execute(Process process, Benchmark benchmark, SynchronousProcessOutputLoggerWithDiagnoser loggerWithDiagnoser, ILogger logger)
        {
            logger.WriteLineInfo("// Execute: " + process.StartInfo.FileName + " " + process.StartInfo.Arguments);

            consoleHandler.SetProcess(process);

            process.Start();

            process.EnsureHighPriority(logger);
            if (benchmark.Job.Env.HasValue(EnvMode.AffinityCharacteristic))
            {
                process.EnsureProcessorAffinity(benchmark.Job.Env.Affinity);
            }

            loggerWithDiagnoser.ProcessInput();

            process.WaitForExit(); // should we add timeout here?

            if (process.ExitCode == 0)
            {
                return(new ExecuteResult(true, process.ExitCode, loggerWithDiagnoser.LinesWithResults, loggerWithDiagnoser.LinesWithExtraOutput));
            }

            return(new ExecuteResult(true, process.ExitCode, new string[0], new string[0]));
        }