You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

84 lines
3.4 KiB

  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using BenchmarkDotNet.Running;
  6. using MQTTnet.Benchmarks.Configurations;
  7. using MQTTnet.Diagnostics;
  8. namespace MQTTnet.Benchmarks
  9. {
  10. public static class Program
  11. {
  12. public static void Main(string[] args)
  13. {
  14. Console.WriteLine($"MQTTnet - Benchmarks ({TargetFrameworkProvider.TargetFramework})");
  15. Console.WriteLine("--------------------------------------------------------");
  16. Console.WriteLine("1 = MessageProcessingBenchmark");
  17. Console.WriteLine("2 = SerializerBenchmark");
  18. Console.WriteLine("3 = LoggerBenchmark");
  19. Console.WriteLine("4 = TopicFilterComparerBenchmark");
  20. Console.WriteLine("5 = ChannelAdapterBenchmark");
  21. Console.WriteLine("6 = MqttTcpChannelBenchmark");
  22. Console.WriteLine("7 = TcpPipesBenchmark");
  23. Console.WriteLine("8 = MessageProcessingMqttConnectionContextBenchmark");
  24. Console.WriteLine("9 = ServerProcessingBenchmark");
  25. Console.WriteLine("a = MqttPacketReaderWriterBenchmark");
  26. Console.WriteLine("b = RoundtripBenchmark");
  27. Console.WriteLine("c = SubscribeBenchmark");
  28. Console.WriteLine("d = UnsubscribeBenchmark");
  29. Console.WriteLine("e = MessageDeliveryBenchmark");
  30. var pressedKey = Console.ReadKey(true);
  31. switch (pressedKey.KeyChar)
  32. {
  33. case '1':
  34. BenchmarkRunner.Run<MessageProcessingBenchmark>();
  35. break;
  36. case '2':
  37. BenchmarkRunner.Run<SerializerBenchmark>();
  38. break;
  39. case '3':
  40. BenchmarkRunner.Run<LoggerBenchmark>();
  41. break;
  42. case '4':
  43. BenchmarkRunner.Run<TopicFilterComparerBenchmark>();
  44. break;
  45. case '5':
  46. BenchmarkRunner.Run<ChannelAdapterBenchmark>();
  47. break;
  48. case '6':
  49. BenchmarkRunner.Run<MqttTcpChannelBenchmark>();
  50. break;
  51. case '7':
  52. BenchmarkRunner.Run<TcpPipesBenchmark>();
  53. break;
  54. case '8':
  55. BenchmarkRunner.Run<MessageProcessingMqttConnectionContextBenchmark>(new RuntimeCompareConfig());
  56. break;
  57. case '9':
  58. BenchmarkRunner.Run<ServerProcessingBenchmark>();
  59. break;
  60. case 'a':
  61. BenchmarkRunner.Run(typeof(MqttPacketReaderWriterBenchmark));
  62. break;
  63. case 'b':
  64. BenchmarkRunner.Run<RoundtripProcessingBenchmark>();
  65. break;
  66. case 'c':
  67. BenchmarkRunner.Run<SubscribeBenchmark>();
  68. break;
  69. case 'd':
  70. BenchmarkRunner.Run<UnsubscribeBenchmark>();
  71. break;
  72. case 'e':
  73. BenchmarkRunner.Run<MessageDeliveryBenchmark>();
  74. break;
  75. }
  76. Console.ReadLine();
  77. }
  78. }
  79. }