static async Task Main(string[] args) { Console.WriteLine("MassTransit Benchmark"); Console.WriteLine(); var optionSet = new ProgramOptionSet(); try { _remaining = optionSet.Parse(args); if (optionSet.Help) { ShowHelp(optionSet); return; } if (optionSet.Verbose) { } optionSet.ShowOptions(); if (optionSet.Threads.HasValue) { ThreadPool.GetMinThreads(out var workerThreads, out var completionPortThreads); ThreadPool.SetMinThreads(Math.Max(workerThreads, optionSet.Threads.Value), completionPortThreads); } if (optionSet.Benchmark.HasFlag(ProgramOptionSet.BenchmarkOptions.Latency)) { await RunLatencyBenchmark(optionSet); } if (optionSet.Benchmark.HasFlag(ProgramOptionSet.BenchmarkOptions.Rpc)) { RunRequestResponseBenchmark(optionSet); } if (Debugger.IsAttached) { Console.Write("Press any key to continue..."); Console.ReadKey(); } } catch (OptionException ex) { Console.Write("mtbench: "); Console.WriteLine(ex.Message); Console.WriteLine("Use 'mtbench --help' for detailed usage information."); } catch (Exception ex) { Console.WriteLine("Crashed: {0}", ex.Message); } }
static void Main(string[] args) { Console.WriteLine("MassTransit Benchmark"); Console.WriteLine(); ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Https; var optionSet = new ProgramOptionSet(); try { _remaining = optionSet.Parse(args); if (optionSet.Help) { ShowHelp(optionSet); return; } if (optionSet.Verbose) { ConfigureLogger(); } optionSet.ShowOptions(); if (optionSet.Benchmark.HasFlag(ProgramOptionSet.BenchmarkOptions.Latency)) { RunLatencyBenchmark(optionSet); } if (optionSet.Benchmark.HasFlag(ProgramOptionSet.BenchmarkOptions.RPC)) { RunRequestResponseBenchmark(optionSet); } if (Debugger.IsAttached) { Console.Write("Press any key to continue..."); Console.ReadKey(); } } catch (OptionException ex) { Console.Write("mtbench: "); Console.WriteLine(ex.Message); Console.WriteLine("Use 'mtbench --help' for detailed usage information."); } }