Ejemplo n.º 1
0
        static void RunPipeBenchmark(string name)
        {
            if (string.IsNullOrEmpty(name) ||
                string.Compare(name, "pump", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                Console.WriteLine($"{nameof(RunPipeBenchmark)} {nameof(Pump)} (1)");
                using (var pipePump = new Pump(HandleType.Pipe, 1))
                {
                    pipePump.Run();
                }

                Console.WriteLine($"{nameof(RunPipeBenchmark)} {nameof(Pump)} (100)");
                using (var pipePump = new Pump(HandleType.Pipe, 100))
                {
                    pipePump.Run();
                }
            }

            if (string.IsNullOrEmpty(name) ||
                string.Compare(name, "pound", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                Console.WriteLine($"{nameof(RunPipeBenchmark)} {nameof(Pound)} (100)");
                using (var tcpPound = new Pound(HandleType.Pipe, 100))
                {
                    tcpPound.Run();
                }

                Console.WriteLine($"{nameof(RunPipeBenchmark)} {nameof(Pound)} (1000)");
                using (var tcpPound = new Pound(HandleType.Pipe, 1000))
                {
                    tcpPound.Run();
                }
            }
        }
Ejemplo n.º 2
0
        static void RunPipeBenchmark(IReadOnlyCollection <string> list)
        {
            if (list.Contains("pipePump", StringComparer.OrdinalIgnoreCase))
            {
                Console.WriteLine($"{nameof(RunPipeBenchmark)} {nameof(Pump)} (1)");
                using (var pipePump = new Pump(HandleType.Pipe, 1))
                {
                    pipePump.Run();
                }

                Console.WriteLine($"{nameof(RunPipeBenchmark)} {nameof(Pump)} (100)");
                using (var pipePump = new Pump(HandleType.Pipe, 100))
                {
                    pipePump.Run();
                }
            }

            if (list.Contains("pipePound", StringComparer.OrdinalIgnoreCase))
            {
                Console.WriteLine($"{nameof(RunPipeBenchmark)} {nameof(Pound)} (100)");
                using (var tcpPound = new Pound(HandleType.Pipe, 100))
                {
                    tcpPound.Run();
                }

                Console.WriteLine($"{nameof(RunPipeBenchmark)} {nameof(Pound)} (1000)");
                using (var tcpPound = new Pound(HandleType.Pipe, 1000))
                {
                    tcpPound.Run();
                }
            }
        }
Ejemplo n.º 3
0
        static void RunTcpBenchmark(string name)
        {
            if (string.IsNullOrEmpty(name) ||
                string.Compare(name, "writeBatch", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(TcpWriteBatch)}");
                using (var tcpWriteBatch = new TcpWriteBatch())
                {
                    tcpWriteBatch.Run();
                }
            }

            if (string.IsNullOrEmpty(name) ||
                string.Compare(name, "pingPong", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(TcpPingPong)}");
                using (var tcpPingPong = new TcpPingPong())
                {
                    tcpPingPong.Run();
                }
            }

            if (string.IsNullOrEmpty(name) ||
                string.Compare(name, "pump", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(Pump)} (1)");
                using (var tcpPump = new Pump(HandleType.Tcp, 1))
                {
                    tcpPump.Run();
                }

                if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(Pump)} (100)");
                    using (var tcpPump = new Pump(HandleType.Tcp, 100))
                    {
                        tcpPump.Run();
                    }
                }
            }

            if (string.IsNullOrEmpty(name) ||
                string.Compare(name, "pound", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(Pound)} (100)");
                using (var tcpPound = new Pound(HandleType.Tcp, 100))
                {
                    tcpPound.Run();
                }

                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(Pound)} (1000)");
                using (var tcpPound = new Pound(HandleType.Tcp, 1000))
                {
                    tcpPound.Run();
                }
            }
        }
Ejemplo n.º 4
0
        static void RunTcpBenchmark(IReadOnlyCollection <string> list)
        {
            if (list.Contains("tcpWriteBatch", StringComparer.OrdinalIgnoreCase))
            {
                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(TcpWriteBatch)}");
                using (var tcpWriteBatch = new TcpWriteBatch())
                {
                    tcpWriteBatch.Run();
                }
            }

            if (list.Contains("tcpPingPong", StringComparer.OrdinalIgnoreCase))
            {
                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(TcpPingPong)}");
                using (var tcpPingPong = new TcpPingPong())
                {
                    tcpPingPong.Run();
                }
            }

            if (list.Contains("tcpPump", StringComparer.OrdinalIgnoreCase))
            {
                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(Pump)} (1)");
                using (var tcpPump = new Pump(HandleType.Tcp, 1))
                {
                    tcpPump.Run();
                }

                if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(Pump)} (100)");
                    using (var tcpPump = new Pump(HandleType.Tcp, 100))
                    {
                        tcpPump.Run();
                    }
                }
            }

            if (list.Contains("tcpPound", StringComparer.OrdinalIgnoreCase))
            {
                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(Pound)} (100)");
                using (var tcpPound = new Pound(HandleType.Tcp, 100))
                {
                    tcpPound.Run();
                }

                Console.WriteLine($"{nameof(RunTcpBenchmark)} {nameof(Pound)} (1000)");
                using (var tcpPound = new Pound(HandleType.Tcp, 1000))
                {
                    tcpPound.Run();
                }
            }
        }