/// <summary> /// Main test starting point. This method instantiate multiple threads and keeps track of /// all of them. /// </summary> public void Test() { try { Thread[] threads = new Thread[_threadCount]; Cache cache = Factory.InitializeCache(_cacheId); cache.ExceptionsEnabled = true; string pid = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); for (int threadIndex = 0; threadIndex < _threadCount; threadIndex++) { ThreadContainer tc = new ThreadContainer(cache, _totalLoopCount, _testCaseIterations, _testCaseIterationDelay, _getsPerIteration, _updatesPerIteration, _dataSize, _expiration, _threadCount, _reportingInterval, threadIndex); ThreadStart threadDelegate = new ThreadStart(tc.DoTest); threads[threadIndex] = new Thread(threadDelegate); threads[threadIndex].Name = "ThreadIndex: " + threadIndex; threads[threadIndex].Start(); } //--- wait on threads to complete their work before finishing for (int threadIndex = 0; threadIndex < threads.Length; threadIndex++) { threads[threadIndex].Join(); } cache.Dispose(); } catch (Exception e) { Console.Error.WriteLine("Error :- " + e.Message); Console.Error.WriteLine(); Console.Error.WriteLine(e.ToString()); } }
/// <summary> /// Main test starting point. This method instantiate multiple threads and keeps track of /// all of them. /// </summary> public void Test() { try { Thread[] threads = new Thread[_threadCount]; Cache cache = Factory.InitializeCache(_cacheId); cache.ExceptionsEnabled = true; string pid = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); for (int threadIndex = 0; threadIndex < _threadCount; threadIndex++) { ThreadContainer tc = new ThreadContainer(cache, _totalLoopCount, _testCaseIterations, _testCaseIterationDelay, _getsPerIteration, _updatesPerIteration, _dataSize, _expiration, _threadCount, _reportingInterval, threadIndex); ThreadStart threadDelegate = new ThreadStart(tc.DoTest); threads[threadIndex] = new Thread(threadDelegate); threads[threadIndex].Name = "ThreadIndex: " + threadIndex; threads[threadIndex].Start(); } //--- wait on threads to complete their work before finishing for (int threadIndex = 0; threadIndex < threads.Length; threadIndex++) { threads[threadIndex].Join(); } cache.Dispose(); } catch (Exception e) { Console.Error.WriteLine("Error :- " + e.Message); Console.Error.WriteLine(); Console.Error.WriteLine(e.ToString()); } }