Exemplo n.º 1
0
        //Métodos privados
        private void StartConn()
        {
            try
            {
                if (environment.VirtualUsers < 1)
                {
                    environment.VirtualUsers = 1;
                }

                if (environment.VirtualUsers > 1000)
                {
                    Console.WriteLine("ConnectionCount exede o limite estabelecido de 1000. Valor alterado para este limite");
                    environment.VirtualUsers = 1000;
                }

                _running = true;

                Int32 queueCount = (Int32)environment.VirtualUsers / 10;
                queueCount = 3;
                if (queueCount <= 0)
                {
                    queueCount = 1;
                }

                _queue = new DBQueue[queueCount];

                for (Int32 i = 0; i < queueCount; i++)
                {
                    _queue[i] = new DBQueue();
                }

                for (Int32 i = 0; i < queueCount; i++)
                {
                    //ChangeDB(i);
                    Debug.WriteLine("procQueue.Start(i); " + i);

                    _queue[i] = new DBQueue();
                    Thread procQueue = new Thread(new ParameterizedThreadStart(ProcQueue));
                    procQueue.Start(i);
                }

                _debug                     = false;
                userCollection             = new VirtualUserCollection(environment);
                userCollection.EnableDebug = true;

                userCollection.OnVUCountReceived += new VirtualUserCollection.VUCountReceived(evtOnVUCountReceived);
                userCollection.OnResultReceived  += new VirtualUserCollection.ResultReceived(evtOnResultReceived);
                userCollection.OnErrorReceived   += new VirtualUserCollection.ErrorReceived(evtOnErrorReceived);
                userCollection.OnDebugEvent      += new VirtualUserCollection.DebugEvent(evtOnDebugEvent);
                userCollection.OnErrorReceived   += new VirtualUserCollection.ErrorReceived(evtOnErrorReceived);
                userCollection.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + ex.StackTrace);
                SendText("StartConn Error:", ex.Message);
            }
        }
Exemplo n.º 2
0
        public void StopConnections()
        {
            //Process.GetCurrentProcess().Kill();

            _running = false;

            if (userCollection != null)
            {
                userCollection.Stop();
            }

            userCollection = null;
        }