Beispiel #1
0
        static double TestReceiveDelay_95()
        {
            var clientCount = 10000;
            var iterationCount = 20000;

            var utils = new TestUtils();
            utils.StartServer(TestControllers.Receive, clientCount);
            var data = utils.GetRandomData(1024);

            Console.WriteLine("Connecting clients");
            var clients = utils.GetIdentifiedConnectedClients(clientCount);

            var rnd = new Random(1);

            Console.WriteLine("Starting test");
            var startTime = DateTime.Now;

            //send small chunks to random clients
            //(can discover troubles in bad handling of large amounts of clients)
            for (var testIndex = 0; testIndex < iterationCount; ++testIndex)
            {
                var clientIndex = rnd.Next(clients.Length);
                var client = clients[clientIndex];
                client.SendData(data);
            }

            return getTransferTime_95(utils, startTime);
        }
Beispiel #2
0
        private static double getTransferTime_95(TestUtils utils, DateTime startTime)
        {
            Console.WriteLine(" waiting");
            utils.WaitOnPendingData();
            var endTime = DateTime.Now;
            Console.WriteLine("End\n");

            var connectionTimes = utils.GetConnectionTimes();
            var transferTimes = utils.GetTransferTimes();

            var transferPercentage = PrintPercentage("Transfer times", transferTimes);
            PrintPercentage("Connection times", connectionTimes);

            var duration = (endTime - startTime).TotalMilliseconds;

            Console.WriteLine("Test duration {0:0.000}", duration);

            return transferPercentage.GetThreshold(0.95);
        }