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; } }
/// <summary> /// This is the entrance of Dynamo Performance Console App /// </summary> /// <param name="args"></param> public static void Main(string[] args) { DirectoryInfo dir; // Running with an input dir location: // DynamoPerformanceTests.exe "C:\directory path\" // if (args.Length <= 0) { Console.WriteLine("Supply a path to a test directory containing DYN files"); } else { try { dir = new DirectoryInfo(args[0]); // Use helper to get debug config in order to run benchmarks on debug build of DynamoCore // PerformanceTestHelper.getDebugConfig(); // Use helper to get debug in process config in order to debug benchmarks // PerformanceTestHelper.getDebugInProcessConfig(); DynamoViewPerformanceTestBase.testDirectory = dir.FullName; var runSummaryWithUI = BenchmarkRunner.Run <DynamoViewPerformanceTestBase>(PerformanceTestHelper.getFastReleaseConfig()); DynamoModelPerformanceTestBase.testDirectory = dir.FullName; var runSummaryWithoutUI = BenchmarkRunner.Run <DynamoModelPerformanceTestBase>(PerformanceTestHelper.getFastReleaseConfig()); } catch { Console.WriteLine("Not a valid path"); } } }