public static void Main(string[] args) { IOutput output = new MultiOutput(new IOutput[] { new HtmlOutput(), new MarkdownOutput(), new ChartOutput(), new CsvOutput(), new ConsoleOutput() }); output.Start(); var containers = ContainerAdapterFactory.CreateAdapters(); bool onlyUpdateChangedContainers = args != null && args.Any(a => a.Equals("-update", StringComparison.OrdinalIgnoreCase)); var csvOutputReader = new CsvOutputReader(); foreach (var container in containers) { Result result = csvOutputReader.GetExistingResult(container.Name); if (result != null) { result.Url = container.Url; } if (!onlyUpdateChangedContainers || result == null || result.Version != container.Version) { result = MeasurePerformance(container); } output.Result(result); } output.Finish(); }
public static void Main(string[] args) { var containers = ContainerAdapterFactory.CreateAdapters().ToArray(); var benchmarks = BenchmarkFactory.CreateBenchmarks().ToArray(); var benchmarkResults = new List <BenchmarkResult>(); var existingBenchmarkResults = new List <BenchmarkResult>(); if (args != null && args.Any(a => a.Equals("-update", StringComparison.OrdinalIgnoreCase))) { existingBenchmarkResults.AddRange(XmlOutputReader.GetExistingBenchmarkResults(benchmarks, containers)); } foreach (var container in containers) { AppDomain childDomain = null; try { AppDomainSetup domainSetup = new AppDomainSetup() { ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase, ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, ApplicationName = AppDomain.CurrentDomain.SetupInformation.ApplicationName, LoaderOptimization = LoaderOptimization.MultiDomainHost }; childDomain = AppDomain.CreateDomain("AppDomain for " + container.Name, null, domainSetup); ContainerAdapterRuntime runtime = (ContainerAdapterRuntime)childDomain.CreateInstanceAndUnwrap( typeof(ContainerAdapterRuntime).Assembly.FullName, typeof(ContainerAdapterRuntime).FullName); var containerBenchmarkResults = runtime.Run(container.GetType(), existingBenchmarkResults); benchmarkResults.AddRange(containerBenchmarkResults); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine( " Container '{0}' failed: {1}", container.Name, ex.Message); Console.ResetColor(); } finally { if (childDomain != null) { AppDomain.Unload(childDomain); } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } Console.WriteLine(); } IOutput output = new MultiOutput( new XmlOutput(), new HtmlOutput(), new MarkdownOutput(), new CsvOutput(), new CsvRateOutput(), new ChartOutput(), new ZipOutput(), new JsonOutput(), new GithubPagesOutput()); output.Create(benchmarks, benchmarkResults); Console.WriteLine("Done"); }
public static void Main(string[] args) { var containers = ContainerAdapterFactory.CreateAdapters().ToArray(); var benchmarks = BenchmarkFactory.CreateBenchmarks().ToArray(); var benchmarkResults = new List <BenchmarkResult>(); var existingBenchmarkResults = new List <BenchmarkResult>(); if (args != null && args.Any(a => a.Equals("-update", StringComparison.OrdinalIgnoreCase))) { existingBenchmarkResults.AddRange(XmlOutputReader.GetExistingBenchmarkResults(benchmarks, containers)); } foreach (var container in containers) { var containerBenchmarkResults = new List <BenchmarkResult>(); Console.WriteLine("{0} {1}", container.Name, container.Version); try { container.Prepare(); foreach (var benchmark in benchmarks) { var benchmarkResult = existingBenchmarkResults.SingleOrDefault(b => b.Container == container && b.Benchmark == benchmark); if (benchmarkResult == null) { benchmark.Warmup(container); benchmarkResult = benchmark.Measure(container); benchmark.Verify(container); } containerBenchmarkResults.Add(benchmarkResult); Console.WriteLine( " {0}{1} {2,10}", benchmarkResult.Benchmark.Name, new string(' ', benchmarks.Select(b => b.Name.Length).OrderByDescending(n => n).First() - benchmarkResult.Benchmark.Name.Length), benchmarkResult.Time); } container.Dispose(); // All benchmarks of container have completed, now 'commit' results benchmarkResults.AddRange(containerBenchmarkResults); } catch (Exception ex) { Console.WriteLine(" " + container.Name + " failed: " + ex.Message); } Console.WriteLine(); } IOutput output = new MultiOutput( new HtmlOutput(), new MarkdownOutput(), new XmlOutput(), new CsvOutput(), new CsvRateOutput(), new ChartOutput()); output.Create(benchmarks, benchmarkResults); Console.WriteLine("Done"); }
public static void Main(string[] args) { var containers = ContainerAdapterFactory.CreateAdapters().ToArray(); var benchmarks = BenchmarkFactory.CreateBenchmarks().ToArray(); var benchmarkResults = new List <BenchmarkResult>(); var existingBenchmarkResults = new List <BenchmarkResult>(); if (args != null && args.Any(a => a.Equals("-update", StringComparison.OrdinalIgnoreCase))) { existingBenchmarkResults.AddRange(XmlOutputReader.GetExistingBenchmarkResults(benchmarks, containers)); } foreach (var container in containers) { var containerBenchmarkResults = new List <BenchmarkResult>(); Console.WriteLine( "{0} {1}{2} {3,10} {4,10}", container.Name, container.Version, new string(' ', benchmarks.Select(b => b.Name.Length).OrderByDescending(n => n).First() - container.Name.Length - container.Version.Length), "Single", "Multi"); container.Prepare(); foreach (var benchmark in benchmarks) { var benchmarkResult = existingBenchmarkResults.SingleOrDefault(b => b.Container == container && b.Benchmark == benchmark); if (benchmarkResult == null) { benchmarkResult = new BenchmarkRunner(container, benchmark).Run(); } containerBenchmarkResults.Add(benchmarkResult); Console.WriteLine( " {0}{1} {2,10} {3,10}", benchmarkResult.Benchmark.Name, new string(' ', benchmarks.Select(b => b.Name.Length).OrderByDescending(n => n).First() - benchmarkResult.Benchmark.Name.Length), benchmarkResult.SingleThreadedResult, benchmarkResult.MultiThreadedResult); } container.Dispose(); // All benchmarks of container have completed, now 'commit' results benchmarkResults.AddRange(containerBenchmarkResults); Console.WriteLine(); } IOutput output = new MultiOutput( new XmlOutput(), new HtmlOutput(), new MarkdownOutput(), new CsvOutput(), new CsvRateOutput(), new ChartOutput(), new ZipOutput()); output.Create(benchmarks, benchmarkResults); Console.WriteLine("Done"); }