Beispiel #1
0
        public static void Main(string[] args)
        {
            var showHelp = false;

            if (args.Length <= 0)
            {
                Console.WriteLine("Please specify a command.");
                return;
            }

            // Default arguments
            IConfig config             = PerformanceTestHelper.getFastReleaseConfig();
            var     testDirectory      = "../../../graphs/";
            var     baseResultsPath    = string.Empty;
            var     newResultsPath     = "BenchmarkDotNet.Artifacts/results/";
            var     saveComparisonPath = string.Empty;

            // Command line options
            var opts = new OptionSet()
            {
                { "g=|graphs=", "Path to Directory containing test graphs. Defaults to 'Dynamo/tools/Performance/DynamoPerformanceTests/graphs/'", v => { testDirectory = v; } },
                { "b=|base=", "Path to Directory containing performance results files to use as comparison base. Defaults to 'BenchmarkDotNet.Artifacts/results/'", v => { baseResultsPath = v; } },
                { "n=|new=", "Path to Directory containing new performance results files to compare against the baseline", v => { newResultsPath = v; } },
                { "s=|save=", "Location to save comparison csv", v => { saveComparisonPath = v; } },
                { "h|help", "show this message and return", v => showHelp = v != null },
            };

            opts.Parse(args);

            // Show help
            if (showHelp)
            {
                ShowHelp(opts);
                return;
            }

            // Get command
            Command command;
            var     commandRecognized = Enum.TryParse(args[0], out command);

            if (!commandRecognized)
            {
                Console.WriteLine("Command \"{0}\" not recognized.", args[0]);
                return;
            }

            // Execute command
            switch (command)
            {
            case Command.NonOptimizedBenchmark:
                config = PerformanceTestHelper.getDebugConfig();
                goto case Command.Benchmark;

            case Command.DebugInProcess:
                config = PerformanceTestHelper.getDebugInProcessConfig();
                goto case Command.Benchmark;

            case Command.Benchmark:
                DynamoViewPerformanceTestBase.testDirectory = testDirectory;
                var runSummaryWithUI = BenchmarkRunner.Run <DynamoViewPerformanceTestBase>(config);

                goto case Command.ModelOnlyBenchmark;

            case Command.ModelOnlyBenchmark:
                DynamoModelPerformanceTestBase.testDirectory = testDirectory;
                var runSummaryWithoutUI = BenchmarkRunner.Run <DynamoModelPerformanceTestBase>(config);
                break;

            case Command.StandardConfigModelOnlyBenchmark:
                config = PerformanceTestHelper.getReleaseConfig();
                goto case Command.ModelOnlyBenchmark;

            case Command.Compare:
                Compare(baseResultsPath, newResultsPath, saveComparisonPath);
                break;
            }
        }