public void WriteRun(BenchmarkRunReport report, bool isWarmup = false) { if (isWarmup) { Console.WriteLine("--------------- BEGIN WARMUP ---------------"); } else { Console.WriteLine("--------------- BEGIN RUN ---------------"); } Console.WriteLine("Elapsed: {0}", report.Elapsed); foreach (var metric in report.Metrics.Values) { Console.WriteLine("{0} - {1}: {2:n} ,{1}: /s {3:n} , ns / {1}: {4:n}", metric.Name, metric.Unit, metric.MetricValue, metric.MetricValuePerSecond, metric.NanosPerMetricValue); } if (isWarmup) { Console.WriteLine("--------------- END WARMUP ---------------"); } else { Console.WriteLine("--------------- END RUN ---------------"); } Console.WriteLine(); }
public void WriteRun(BenchmarkRunReport report, bool isWarmup = false) { if (isWarmup) Console.WriteLine("--------------- BEGIN WARMUP ---------------"); else { Console.WriteLine("--------------- BEGIN RUN ---------------"); } Console.WriteLine("Elapsed: {0}", report.Elapsed); foreach (var metric in report.Metrics.Values) { Console.WriteLine("{0} - {1}: {2:n} ,{1}: /s {3:n} , ns / {1}: {4:n}", metric.Name, metric.Unit, metric.MetricValue, metric.MetricValuePerSecond, metric.NanosPerMetricValue); } if (isWarmup) Console.WriteLine("--------------- END WARMUP ---------------"); else { Console.WriteLine("--------------- END RUN ---------------"); } Console.WriteLine(); }
public BenchmarkReport Run(Benchmark benchmark, IList <string> importantPropertyNames) { Logger.WriteLineHeader("// **************************"); Logger.WriteLineHeader("// Benchmark: " + benchmark.Description); var directoryPath = benchmarkProjectGenerator.GenerateProject(benchmark); Logger.WriteLineInfo("// Generated project: " + directoryPath); Logger.NewLine(); Logger.WriteLineInfo("// Build:"); var buildResult = benchmarkProjectGenerator.BuildProject(directoryPath); if (buildResult.OverallResult == BuildResultCode.Success) { Logger.WriteLineInfo("// OverallResult = Success"); } else { Logger.WriteLineError("// OverallResult = Failure"); return(new BenchmarkReport(benchmark, new BenchmarkRunReport[0])); } Logger.NewLine(); var processCount = Math.Max(1, benchmark.Task.ProcessCount); var runReports = new List <BenchmarkRunReport>(); var exeFileName = Path.Combine(directoryPath, "Program.exe"); for (int processNumber = 0; processNumber < processCount; processNumber++) { Logger.WriteLineInfo($"// Run, Process: {processNumber + 1} / {processCount}"); if (importantPropertyNames.Any()) { Logger.WriteInfo("// "); foreach (var name in importantPropertyNames) { Logger.WriteInfo($"{name}={benchmark.Properties.GetValue(name)} "); } Logger.NewLine(); } var executor = new BenchmarkExecutor(Logger); if (File.Exists(exeFileName)) { var lines = executor.Exec(exeFileName, benchmark.Task.Settings.ToArgs()); var iterRunReports = lines.Select(line => BenchmarkRunReport.Parse(Logger, line)).Where(r => r != null).ToList(); runReports.AddRange(iterRunReports); } } Logger.NewLine(); return(new BenchmarkReport(benchmark, runReports)); }
private List <BenchmarkRunReport> Execute(IBenchmarkLogger logger, Benchmark benchmark, IList <string> importantPropertyNames, BenchmarkParameters parameters, IBenchmarkToolchainFacade toolchain, BenchmarkBuildResult buildResult) { logger.WriteLineInfo("// *** Execute ***"); var processCount = Math.Max(1, benchmark.Task.ProcessCount); var runReports = new List <BenchmarkRunReport>(); for (int processNumber = 0; processNumber < processCount; processNumber++) { logger.WriteLineInfo($"// Run, Process: {processNumber + 1} / {processCount}"); if (parameters != null) { logger.WriteLineInfo($"// {parameters.ToInfo()}"); } if (importantPropertyNames.Any()) { logger.WriteInfo("// "); foreach (var name in importantPropertyNames) { logger.WriteInfo($"{name}={benchmark.Properties.GetValue(name)} "); } logger.NewLine(); } var execResult = toolchain.Execute(buildResult, parameters, Plugins.CompositeDiagnoser); if (execResult.FoundExecutable) { var iterRunReports = execResult.Data.Select(line => BenchmarkRunReport.Parse(logger, line)).Where(r => r != null).ToList(); runReports.AddRange(iterRunReports); } else { logger.WriteLineError("Executable not found"); } } logger.NewLine(); return(runReports); }
public void WriteRun(BenchmarkRunReport report, bool isWarmup = false) { // no-op }
public void WriteRun(BenchmarkRunReport report, bool isWarmup = false) { _runAction(report, isWarmup); }