Пример #1
0
        public override void ThreadMain()
        {
            System.Console.WriteLine("Running PulseTests: Thread {0}\n", Thread.CurrentThread.GetThreadId());
            Console.Write("passes={0}", passes);
            Console.WriteLine(" cpuCount={0}", cpuCount);

            for (int pass = 0; pass < passes; pass++)
            {
                Console.WriteLine("pass={0}", pass);

                UnitTest.Clear();
                threadCount = 0;

                for (int i = 0; i < cpuCount; i++)
                {
                    // 50 threads
                    if (!CheckMaxThreads(50))
                    {
                        UnitTest.Add("Many Threads PulseAll",
                                     new UnitTest.TestDelegate(PulseAllTest.ManyThreadsTest));
                    }

                    // 8 threads
                    if (!CheckMaxThreads(8))
                    {
                        UnitTest.Add("Few Threads PulseAll",
                                     new UnitTest.TestDelegate(PulseAllTest.FewThreadsTest));
                    }

                    // 17 threads
                    if (!CheckMaxThreads(17))
                    {
                        UnitTest.Add("Low-density Pulse",
                                     new UnitTest.TestDelegate(PulseTest.LowDensityTest));
                    }

                    // 32 threads
                    if (!CheckMaxThreads(32))
                    {
                        UnitTest.Add("Medium-density Pulse",
                                     new UnitTest.TestDelegate(PulseTest.MediumDensityTest));
                    }

                    // 128 threads
                    if (!CheckMaxThreads(128))
                    {
                        UnitTest.Add("High-density Pulse",
                                     new UnitTest.TestDelegate(PulseTest.HighDensityTest));
                    }
                }

                Console.WriteLine("{0} PulseThreads", threadCount);

                // Wait for the sub-threads to run
                if (UnitTest.Run(true) != UnitTest.Result.Passed)
                {
                    Console.WriteLine("PulseTest failed!\n");
                }
            }

            // This exits the thread
            return;
        }