コード例 #1
0
        private static void ReadDemoData()
        {
            var test = new RamDriverTest();

            try
            {
                test.InitializeEmbeddedServer();
                test.ReadDataFromStore();
            }
            finally
            {
                test.TestShutdown();
            }
        }
コード例 #2
0
        private static void GenerateDemoData()
        {
            var test = new RamDriverTest();

            try
            {
                test.InitializeEmbeddedServer();

                // warm-up
                RunMultithreaded(test, 8, 1, 100000, DemoDataGenAction);

                test.FlushDriverToStore();
            }
            finally
            {
                test.TestShutdown();
            }
        }
コード例 #3
0
        private static void PerformanceTest()
        {
            var test = new RamDriverTest();

            try
            {
                test.InitializeEmbeddedServer();

                // warm-up
                RunMultithreaded(test, 8, 1, 10, TestThreadAction);

                Console.WriteLine("Press ENTER to start");
                Console.ReadLine();

                // now go
                RamDriverTest.SetThreadContext(-1);

                var count      = 100000;
                var numThreads = 8;

                for (var i = 0; i < 5; i++)
                {
                    test.DeleteRange(100000000, -1);
                    RunMultithreaded(test, numThreads, 1, count, TestThreadAction);
                    ShowCount(test);
                }

                test.DeleteRange(1000, 1000);
                ShowCount(test);
            }
            finally
            {
                test.TestShutdown();
            }

            Console.WriteLine("Press ENTER to run full GC");
            Console.ReadLine();
            GC.Collect(2, GCCollectionMode.Forced, true);
            GC.Collect(2, GCCollectionMode.Forced, true);
            GC.Collect(2, GCCollectionMode.Forced, true);
            Console.WriteLine("Press ENTER to exit");
            Console.ReadLine();
        }