示例#1
0
        private static void Main(string[] args)
        {
            var port   = 5053;
            var server = new StaticDnsServer(
                printStats: false,
                port: port,
                workers: 2);

            server.Start();

            var options = new LookupClientOptions(new NameServer(IPAddress.Parse("127.0.0.1"), port))
            {
                UseCache            = false,
                EnableAuditTrail    = false,
                UseTcpFallback      = false,
                ThrowDnsErrors      = false,
                MinimumCacheTimeout = null,
                Retries             = 0,
                Timeout             = Timeout.InfiniteTimeSpan
            };

            var client = new LookupClient(options);

            var tasksCount = 12;

            //Console.WriteLine("warmup");
            //RunSync(client, 5, tasksCount);
            //RunAsync(client, 5, tasksCount).Wait();
            Console.WriteLine("running...");
            Console.ReadKey();
            double runTime = 2;

            for (var i = 1; i <= 3; i++)
            {
                for (var run = 0; run < 5; run++)
                {
                    RunSync(client, runTime, tasksCount * i);

                    RunAsync(client, runTime, tasksCount * i).GetAwaiter().GetResult();
                }
            }

            server.Stop();
        }
示例#2
0
        public static void Main(string[] args)
        {
            var port   = 5053;
            var server = new StaticDnsServer(
                printStats: false,
                port: port,
                workers: 1);

            server.Start();

#if NETCOREAPP2_1
            new DnsClientBenchmarks.StringSplit().ManualSplitMemoryT2();
#endif
            do
            {
                //var config = ManualConfig.Create(DefaultConfig.Instance)
                //.With(exporters: BenchmarkDotNet.Exporters.DefaultExporters.)
                //.With(BenchmarkDotNet.Analysers.EnvironmentAnalyser.Default)
                //.With(BenchmarkDotNet.Exporters.MarkdownExporter.GitHub)
                //.With(BenchmarkDotNet.Exporters.MarkdownExporter.StackOverflow)
                //.With(BenchmarkDotNet.Diagnosers.MemoryDiagnoser.Default)
                //.With(Job.Core
                //    .WithIterationCount(10)
                //    .WithWarmupCount(5)
                //    .WithLaunchCount(1))
                //.With(Job.Clr
                //    .WithIterationCount(10)
                //    .WithWarmupCount(5)
                //    .WithLaunchCount(1));

                BenchmarkSwitcher
                .FromAssembly(typeof(DnsClientBenchmarks).Assembly)
                .Run(args, new Config());

                Console.WriteLine("done!");
                Console.WriteLine("Press escape to exit or any key to continue...");
            } while (Console.ReadKey().Key != ConsoleKey.Escape);

            server.Stop();
        }
示例#3
0
        public static void Main(string[] args)
        {
            var port   = 5053;
            var server = new StaticDnsServer(
                printStats: false,
                port: port,
                workers: 1);

            server.Start();

            do
            {
                var config = ManualConfig.Create(DefaultConfig.Instance)
                             //.With(exporters: BenchmarkDotNet.Exporters.DefaultExporters.)
                             .With(BenchmarkDotNet.Analysers.EnvironmentAnalyser.Default)
                             .With(BenchmarkDotNet.Exporters.MarkdownExporter.GitHub)
                             .With(BenchmarkDotNet.Exporters.MarkdownExporter.StackOverflow)
                             .With(BenchmarkDotNet.Diagnosers.MemoryDiagnoser.Default)
                             .With(Job.Core
                                   .WithTargetCount(10)
                                   .WithWarmupCount(5)
                                   .WithLaunchCount(1))
                             .With(Job.Clr
                                   .WithTargetCount(10)
                                   .WithWarmupCount(5)
                                   .WithLaunchCount(1));

                BenchmarkSwitcher
                .FromAssembly(typeof(DnsClientBenchmarks).GetTypeInfo().Assembly)
                .Run(args, config);

                Console.WriteLine("done!");
                Console.WriteLine("Press escape to exit or any key to continue...");
            } while (Console.ReadKey().Key != ConsoleKey.Escape);

            server.Stop();
        }