Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Random rnd    = new Random(123456789);
            var    client = new DNSClient();

            var defaultList = new string[] {
                "www.ksi.ms.mff.cuni.cz",
                "parlab.ms.mff.cuni.cz",
                "www.seznam.cz",
                "www.google.com",
                "www.share.home.alabanda.cz"
            };
            var generatedList = GenerateDomains(rnd);
            var domainList    = generatedList;

            client.InitData(domainList);
            Console.WriteLine("Total {0} logical processors detected.", Environment.ProcessorCount);
            Console.WriteLine("Warming up thread pool...");
            WarmUpThreadPool();

            Console.WriteLine("{0}", ThreadPool.ThreadCount);
            string[] testBatch = domainList.Take(100).ToArray();
            ComparisonTestBatch(client, Shuffle(rnd, testBatch));

            Console.WriteLine("{0}", ThreadPool.ThreadCount);
        }
Ejemplo n.º 2
0
        static private void ComparisonTestBatch(DNSClient client, string[] domains)
        {
            var resolver = new RecursiveResolver(client);

            for (int i = 0; i < 1; ++i)
            {
                var sum = RunTestBatch(resolver, domains);
                Console.WriteLine("TIME: {0} ms", sum);
            }

            /*var serialResolver = new SerialRecursiveResolver(client);
             * var resolver = new RecursiveResolver(client);
             * var sumSerial = RunTestBatch(serialResolver, domains);
             * serialResolver = new SerialRecursiveResolver(client);
             * var sum = RunTestBatch(serialResolver, domains);
             * serialResolver = new SerialRecursiveResolver(client);
             * var sumSerial0 = RunTestBatch(serialResolver, domains);
             * serialResolver = new SerialRecursiveResolver(client);
             * var sum0 = RunTestBatch(serialResolver, domains);
             * serialResolver = new SerialRecursiveResolver(client);
             * var sum1 = RunTestBatch(serialResolver, domains);
             * serialResolver = new SerialRecursiveResolver(client);
             * var sum2 = RunTestBatch(serialResolver, domains);
             * Console.WriteLine("TIME: {0} ms", sumSerial);
             * Console.WriteLine("TIME: {0} ms", sum);
             * Console.WriteLine("TIME: {0} ms", sumSerial0);
             * Console.WriteLine("TIME: {0} ms", sum0);
             * Console.WriteLine("TIME: {0} ms", sum1);
             * Console.WriteLine("TIME: {0} ms", sum2);
             * Console.WriteLine("AVG EFFICIENCY IS {0} %", sumSerial * 100 / sum);
             * Console.WriteLine("AVG EFFICIENCY IS {0} %", sumSerial0 * 100 / sum0);*/
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            DNSClient client = InitClient();

            var separator = new string('=', 10);

            IList <IRecursiveResolver> resolvers = new List <IRecursiveResolver>()
            {
                // First serial should perform same as expected.
                new SerialRecursiveResolver(client),

                // Final Solution will be here.
                new RecursiveResolver(client),
            };

            Console.WriteLine($"{separator}Starting Tests{separator} Threads: {ThreadPool.ThreadCount}");

            //RunTest(resolvers, originalArray);
            //RunTest(resolvers, originalArray2);
            //RunTest(resolvers, reverseArray);
            //RunTest(resolvers, inorderLong);
            //RunTest(resolvers, outorderLong);
            //RunTest(resolvers, customShort);
            //RunTest(resolvers, customMedium);
            //RunTest(resolvers, customLong);
            //RunTest(resolvers, customUniqueOnly);
            RunTest(resolvers, customAllAvailable);

            Console.WriteLine($"{separator}Repeated Test are after this:{separator}");



            Console.WriteLine($"{separator}Ending Tests{separator} Threads: {ThreadPool.ThreadCount}");
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            var client = new DNSClient();

            client.InitData(new string[] {
                "www.ksi.ms.mff.cuni.cz",
                "parlab.ms.mff.cuni.cz",
                "www.seznam.cz",
                "www.google.com",
            });
            var resolver = new RecursiveResolver(client);

            Console.WriteLine("Total {0} logical processors detected.", Environment.ProcessorCount);
            Console.WriteLine("Warming up thread pool...");
            WarmUpThreadPool();

            Console.WriteLine("{0}", ThreadPool.ThreadCount);

            RunTestBatch(resolver, new string[] {
                "www.ksi.ms.mff.cuni.cz",
                "ksi.ms.mff.cuni.cz",
                "ms.mff.cuni.cz",
                "mff.cuni.cz",
                "cuni.cz",
                "cz",
            });

            RunTestBatch(resolver, new string[] {
                "parlab.ms.mff.cuni.cz",
                "www.seznam.cz",
                "www.google.com",
            });

            Console.WriteLine("{0}", ThreadPool.ThreadCount);
        }
Ejemplo n.º 5
0
        private static DNSClient InitClient()
        {
            var client = new DNSClient();

            client.InitData(new string[]
            {
                "www.parlab.ms.mff.cuni.cz",
                "www.ksi.ms.mff.cuni.cz",
                "www.seznam.cz",
                "www.google.com",
                "A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z",
                "intranet.android.runner.for.ever.eu",
                "ShortestPossibleAddress",
                "a.b.c.x.y.z",
            });
            Console.WriteLine("Total {0} logical processors detected.", Environment.ProcessorCount);
            Console.WriteLine("Warming up thread pool...");
            WarmUpThreadPool();
            Console.WriteLine("{0}", ThreadPool.ThreadCount);
            return(client);
        }