private void RunCompetitions(string[] args)
 {
     for (int i = 0; i < Competitions.Length; i++)
     {
         var competition = Competitions[i];
         if (args.Any(arg => competition.Name.ToLower().StartsWith(arg.ToLower())) || args.Contains("#" + i) || args.Contains("*"))
         {
             logger.WriteLineHeader("Target competition: " + competition.Name);
             List<BenchmarkReport> reports;
             using (var logStreamWriter = new StreamWriter(competition.Name + ".log"))
             {
                 var loggers = new IBenchmarkLogger[] { new BenchmarkConsoleLogger(), new BenchmarkStreamLogger(logStreamWriter) };
                 var runner = new BenchmarkRunner(loggers);
                 reports = runner.RunCompetition(Activator.CreateInstance(competition), BenchmarkSettings.Parse(args)).ToList();
             }
             MarkdownReportExporter.Default.SaveToFile(reports, competition.Name + "-report.md");
             CsvReportExporter.Default.SaveToFile(reports, competition.Name + "-report.csv");
             logger.NewLine();
         }
     }
     if (args.Length > 0 && (args[0].StartsWith("http://") || args[0].StartsWith("https://")))
     {
         var url = args[0];
         Uri uri = new Uri(url);
         var name = uri.IsFile ? Path.GetFileName(uri.LocalPath) : "URL";
         using (var logStreamWriter = new StreamWriter(name + ".log"))
         {
             var loggers = new IBenchmarkLogger[] { new BenchmarkConsoleLogger(), new BenchmarkStreamLogger(logStreamWriter) };
             var runner = new BenchmarkRunner(loggers);
             runner.RunUrl(url, BenchmarkSettings.Parse(args));
         }
     }
 }
 public void TestMethod1()
 {
     var reports = new BenchmarkRunner().Run<IfSwitchMethodContainer>();
     foreach (BenchmarkReport report in reports)
     {
         Console.WriteLine(report.ToString());
     }
 }
Exemple #3
0
 public static void Main()
 {
     using (var writer = new StreamWriter("benchmark.log"))
     {
         var runner = new BenchmarkRunner(new IBenchmarkLogger[] { new BenchmarkStreamLogger(writer), new BenchmarkConsoleLogger() });
         runner.RunCompetition(new ArrayAccessCompetition());
         runner.RunCompetition(new DictionaryCompetition());
         runner.RunCompetition(new SetFieldCompetition());
         runner.RunCompetition(new GraphWithBlobReplicationCompetition());
         runner.RunCompetition(new SimpleGraphReplicationCompetition());
     }
 }
        static void Main(string[] args)
        {
            // This currently doesn't work, because the BenchmarkBaselineDeltaResultExtender() is NEVER wired up!!!!!!
            //new BenchmarkRunner().Run<BenchmarkProgram>();

            var logger = new BenchmarkAccumulationLogger();
            var extender = new BenchmarkBaselineDeltaResultExtender();
            var plugins = BenchmarkPluginBuilder.CreateDefault()
                                .AddLogger(logger)
                                .AddResultExtender(extender)
                                .Build();
            var reports = new BenchmarkRunner(plugins).Run<BenchmarkProgram>();
        }
 private void RunCompetitions(string[] args)
 {
     for (int i = 0; i < Competitions.Length; i++)
     {
         var competition = Competitions[i];
         if (args.Any(arg => competition.Name.ToLower().StartsWith(arg.ToLower())) || args.Contains("#" + i) || args.Contains("*"))
         {
             logger.WriteLineHeader("Target competition: " + competition.Name);
             using (var logStreamWriter = new StreamWriter(competition.Name + ".log"))
             {
                 var loggers = new IBenchmarkLogger[] {new BenchmarkConsoleLogger(), new BenchmarkStreamLogger(logStreamWriter)};
                 var runner = new BenchmarkRunner(loggers);
                 runner.RunCompetition(Activator.CreateInstance(competition), BenchmarkSettings.Parse(args));
             }
             logger.NewLine();
         }
     }
 }
Exemple #6
0
 static void Main(string[] args)
 {
     IBenchmarkLogger[] loggers =
     {
         new BenchmarkConsoleLogger(),
         new BenchmarkStreamLogger("simple_all.md")
     };
     var runner = new BenchmarkRunner(loggers);
     var reports = runner.RunCompetition(new SimpleComparisonTest()).ToList();
     runner.ReportExporter.Export(reports, runner.Logger);
 }
Exemple #7
0
 static void Main(string[] args)
 {
     var runner = new BenchmarkRunner();
     runner.Run<BenchGenericDeserialize>();
 }