示例#1
0
        public static void RunTest()
        {
            SpinWaitHelper.WaitUntilNormalizationCoefCalculated();
            Console.WriteLine($"SpinWait norm coef = {SpinWaitHelper.NormalizationCoef}");

            for (int i = 0; i < 10; i++)
            {
                RunConcurrentMemQ("1, 1", 5000000, 1, 1, 4, 4);
                Free();

                RunConcurrentMemQ("4, 4", 5000000, 4, 4, 4, 4);
                Free();

                RunConcurrentMemQ("16, 1", 5000000, 16, 1, 4, 4);
                Free();

                RunConcurrentMemQ("1, 16", 5000000, 1, 16, 4, 4);
                Free();

                RunConcurrentMemQ("16, 16", 5000000, 16, 16, 4, 4);
                Free();

                Console.WriteLine();


                RunConcurrentLvlQ("1, 1", 5000000, 1, 1, 4, 4);
                Free();

                RunConcurrentLvlQ("4, 4", 5000000, 4, 4, 4, 4);
                Free();

                RunConcurrentLvlQ("16, 1", 5000000, 16, 1, 4, 4);
                Free();

                RunConcurrentLvlQ("1, 16", 5000000, 1, 16, 4, 4);
                Free();

                RunConcurrentLvlQ("16, 16", 5000000, 16, 16, 4, 4);
                Free();

                Console.WriteLine();


                RunConcurrentDiskQ("1, 1", 5000000, 1, 1, 4, 4);
                Free();

                RunConcurrentDiskQ("4, 4", 5000000, 4, 4, 4, 4);
                Free();

                RunConcurrentDiskQ("16, 1", 5000000, 16, 1, 4, 4);
                Free();

                RunConcurrentDiskQ("1, 16", 5000000, 1, 16, 4, 4);
                Free();

                RunConcurrentDiskQ("16, 16", 5000000, 16, 16, 4, 4);
                Free();

                Console.WriteLine();


                RunConcurrentDiskQFile("1, 1", 5000000, 1, 1, 4, 4);
                Free();

                RunConcurrentDiskQFile("4, 4", 5000000, 4, 4, 4, 4);
                Free();

                RunConcurrentDiskQFile("16, 1", 5000000, 16, 1, 4, 4);
                Free();

                RunConcurrentDiskQFile("1, 16", 5000000, 1, 16, 4, 4);
                Free();

                RunConcurrentDiskQFile("16, 16", 5000000, 16, 16, 4, 4);
                Free();

                Console.WriteLine();
            }
        }
示例#2
0
        public static void RunTest()
        {
            //TstBQ();

            //Process.GetCurrentProcess().ProcessorAffinity = (IntPtr)1;
            SpinWaitHelper.WaitUntilNormalizationCoefCalculated();
            Console.WriteLine($"SpinWait norm coef = {SpinWaitHelper.NormalizationCoef}");


            for (int i = 0; i < 10; i++)
            {
                RunConcurrentBC("1, 1", 5000000, 1, 1, 20, 20);
                Free();

                RunConcurrentBC("4, 4", 5000000, 4, 4, 20, 20);
                Free();

                RunConcurrentBC("16, 1", 5000000, 16, 1, 20, 20);
                Free();

                RunConcurrentBC("1, 16", 5000000, 1, 16, 20, 20);
                Free();

                RunConcurrentBC("16, 16", 5000000, 16, 16, 20, 20);
                Free();

                Console.WriteLine();

                RunConcurrentBQ("1, 1", 5000000, 1, 1, 20, 20);
                Free();

                RunConcurrentBQ("4, 4", 5000000, 4, 4, 20, 20);
                Free();

                RunConcurrentBQ("16, 1", 5000000, 16, 1, 20, 20);
                Free();

                RunConcurrentBQ("1, 16", 5000000, 1, 16, 20, 20);
                Free();

                RunConcurrentBQ("16, 16", 5000000, 16, 16, 20, 20);
                Free();

                Console.WriteLine();

                RunConcurrentCondVar("1, 1", 5000000, 1, 1, 20, 20);
                Free();

                RunConcurrentCondVar("4, 4", 5000000, 4, 4, 20, 20);
                Free();

                RunConcurrentCondVar("16, 1", 5000000, 16, 1, 20, 20);
                Free();

                RunConcurrentCondVar("1, 16", 5000000, 1, 16, 20, 20);
                Free();

                RunConcurrentCondVar("16, 16", 5000000, 16, 16, 20, 20);
                Free();

                Console.WriteLine();

                RunConcurrentMon("1, 1", 5000000, 1, 1, 20, 20);
                Free();

                RunConcurrentMon("4, 4", 5000000, 4, 4, 20, 20);
                Free();

                RunConcurrentMon("16, 1", 5000000, 16, 1, 20, 20);
                Free();

                RunConcurrentMon("1, 16", 5000000, 1, 16, 20, 20);
                Free();

                RunConcurrentMon("16, 16", 5000000, 16, 16, 20, 20);
                Free();

                //RunConcurrentBC("Simple", 5000000, /*Environment.ProcessorCount */ 2, 2, 10, 100);//100 / Environment.ProcessorCount, 101);
                //Free();

                //RunConcurrentBQ("Simple", 5000000, /*Environment.ProcessorCount */ 2, 2, 10, 100);//100 / Environment.ProcessorCount, 101);
                //Free();


                //RunConcurrentBC("OverConcurrency", 5000000, /*4 * Environment.ProcessorCount*/ 8, 8, 0, 0);//100 / Environment.ProcessorCount, 101);
                //Free();

                //RunConcurrentBQ("OverConcurrency", 5000000, /*4 * Environment.ProcessorCount*/ 8, 8, 0, 0);//100 / Environment.ProcessorCount, 101);
                //Free();


                //RunConcurrentBC("OverConcurrency fix", 5000000, /*4 * Environment.ProcessorCount*/ 16, 16, 0, 0);
                //Free();

                //RunConcurrentBQ("OverConcurrency fix", 5000000, /*4 * Environment.ProcessorCount*/ 16, 16, 0, 0);
                //Free();


                Console.WriteLine();
            }
        }
示例#3
0
        public static void RunTest()
        {
            SpinWaitHelper.WaitUntilNormalizationCoefCalculated();
            Console.WriteLine($"SpinWait norm coef = {SpinWaitHelper.NormalizationCoef}");

            //TestStaticThreadPool(4, 4, 10000000, 1);
            //TestStaticThreadPool(4, 4, 10000000, 1);
            //TestStaticThreadPool(4, 4, 10000000, 1);

            for (int i = 0; i < 3; i++)
            {
                RunTestBCL(8, 1, 10000000, 20);
            }

            for (int i = 0; i < 3; i++)
            {
                TestNewDynamicPool(8, 1, 10000000, 20);
            }

            //for (int i = 0; i < 3; i++)
            //    TestNewStaticPool(8, 1, 10000000, 20);

            //for (int i = 0; i < 1; i++)
            //    RunTestSimple(8, 16, 10000000, 10);

            //for (int i = 0; i < 1; i++)
            //    RunTestObjectPoolWithLListSimple(8, 16, 10000000, 10);

            //for (int i = 0; i < 1; i++)
            //    RunTestObjectPoolWithSyncPrior(8, 16, 10000000, 10);


            //for (int i = 0; i < 1; i++)
            //    TestStaticPool(8, 16, 10000000, 10);

            //for (int i = 0; i < 1; i++)
            //    TestNewStaticPool(8, 4, 10000000, 10);

            //for (int i = 0; i < 1; i++)
            //    TestDynamicPool(8, 2, 10000000, 10);

            //for (int i = 0; i < 3; i++)
            //    TestNewDynamicPool(8, 4, 10000000, 10);

            //for (int i = 0; i < 1; i++)
            //    TestBalancingStaticPool(8, 16, 10000000, 10);

            //for (int i = 0; i < 1; i++)
            //    TestBalancingDynamicPool(8, 160, 10000000, 10);

            //for (int i = 0; i < 3; i++)
            //    TestNewBalancingStaticPool(8, 1, 10000000, 100);

            //for (int i = 0; i < 4; i++)
            //    TestNewBalancingDynamicPool(8, 16, 10000000, 10);

            //TestStaticThreadPool(8, 4, 10000, 1);
            //TestStaticThreadPool(8, 4, 10000, 1);
            //TestStaticThreadPool(8, 4, 10000, 1);

            // 5152 vs 5500

            // 9600 vs 9400


            // 3500 vs 3500
            // 3800 vs 3800

            // 2700 vs 3100

            // 1100

            // 4500
        }