Пример #1
0
 public void RemoveSuite(BenchmarkSuite suite)
 {
     foreach (var instance in _suites.Where(instance => instance.Suite == suite))
     {
         RemoveSuite(instance);
         return;
     }
 }
Пример #2
0
        private void DoBenchmark()
        {
            BenchmarkSuite testSuite = new BenchmarkSuite();

            testSuite.OnTestFinish += Report;

            try
            {
                foreach (var benchmark in History)
                {
                    if (Cancellation.IsCancellationRequested)
                    {
                        break;
                    }

                    Current = benchmark;
                    testSuite.ExecuteInit(benchmark);

                    // Write.
                    ApplicationManager.SetCurrentMethod(TestMethod.Write);
                    CurrentStatus = TestMethod.Write.ToString();

                    testSuite.ExecuteWrite(benchmark);

                    // Read.
                    ApplicationManager.SetCurrentMethod(TestMethod.Read);
                    CurrentStatus = TestMethod.Read.ToString();

                    testSuite.ExecuteRead(benchmark);

                    // Secondary Read.
                    ApplicationManager.SetCurrentMethod(TestMethod.SecondaryRead);
                    CurrentStatus = TestMethod.SecondaryRead.ToString();

                    testSuite.ExecuteSecondaryRead(benchmark);

                    // Finish.
                    CurrentStatus = TestMethod.None.ToString();
                    testSuite.ExecuteFinish(benchmark);
                }
            }
            finally
            {
                Current = null;

                if (Cancellation.IsCancellationRequested)
                {
                    History.Clear();
                }
                else
                {
                    if (!(bool)Properties.Settings.Default["HideReportForm"])
                    {
                        StartOnlineReport();
                    }
                }
            }
        }
        public BenchmarkSuiteInstance(BenchmarkSuite suite)
        {
            _suite = suite;

            foreach (var benchmark in suite.Benchmarks)
            {
                _benchmarks.Add(new BenchmarkInstance(this, benchmark));
            }
        }
Пример #4
0
        /// <summary>
        /// Perform many search
        /// </summary>
        private static void RunSearch()
        {
            //Search bm
            BenchmarkSuite bms2 = new BenchmarkSuite();

            bms2.AddRunnable(new int[] { 2, 30, 10 }, "Search-2-30-10", new NoSqlQueryItem(), new SqlQueryItem());
            bms2.AddRunnable(new int[] { 2, 10, 10 }, "Search-2-10-10", new NoSqlQueryItem(), new SqlQueryItem());
            bms2.AddRunnable(new int[] { 2, 1, 10 }, "Search-2-1-10", new NoSqlQueryItem(), new SqlQueryItem());

            bms2.ExecuteAll();

            bms2.WriteResultToConsole();
        }
Пример #5
0
        /// <summary>
        /// add data in transaction
        /// </summary>
        private static void RunAddDataInTransaction()
        {
            //Transaction bm
            BenchmarkSuite bms3 = new BenchmarkSuite();

            bms3.AddRunnable(10, "Trans-10", new NoSqlTransaction(), new SqlTransaction());
            bms3.AddRunnable(100, "Trans-100", new NoSqlTransaction(), new SqlTransaction());
            bms3.AddRunnable(1000, "Trans-1000", new NoSqlTransaction(), new SqlTransaction());
            bms3.AddRunnable(10000, "Trans-10000", new NoSqlTransaction(), new SqlTransaction());
            bms3.AddRunnable(40000, "Trans-30000", new NoSqlTransaction(), new SqlTransaction());

            bms3.ExecuteAll();

            bms3.WriteResultToConsole();
        }
Пример #6
0
        /// <summary>
        /// Run report test
        /// </summary>
        private static void RunReports(bool testExport)
        {
            BenchmarkSuite bms4 = new BenchmarkSuite();

            bms4.AddRunnable("kpi", "KPI", new NoSqlAnalytics(), new SqlAnalytics());
            bms4.AddRunnable("kpi", "Report", new NoSqlAnalytics(), new SqlAnalytics());
            if (testExport)
            {
                bms4.AddRunnable("export", "Export", new NoSqlAnalytics(), new SqlAnalytics());
            }

            bms4.ExecuteAll();

            bms4.WriteResultToConsole();
        }
Пример #7
0
        /// <summary>
        /// Insert many rows in batch statement to db
        /// </summary>
        private static void RunInsertBulk()
        {
            //Bulk insert bm
            BenchmarkSuite bms = new BenchmarkSuite();

            bms.AddRunnable(1, "BulkInsert-1", new NoSqlAddItem(), new SqlAddItem());
            bms.AddRunnable(10, "BulkInsert-10", new NoSqlAddItem(), new SqlAddItem());
            bms.AddRunnable(100, "BulkInsert-100", new NoSqlAddItem(), new SqlAddItem());
            bms.AddRunnable(1000, "BulkInsert-1000", new NoSqlAddItem(), new SqlAddItem());
            bms.AddRunnable(10000, "BulkInsert-10000", new NoSqlAddItem(), new SqlAddItem());
            bms.AddRunnable(100000, "BulkInsert-100000", new NoSqlAddItem(), new SqlAddItem());
            bms.AddRunnable(1000000, "BulkInsert-1000000", new NoSqlAddItem(), new SqlAddItem());

            bms.ExecuteAll();

            bms.WriteResultToConsole();
        }
Пример #8
0
        public void AddSuitesFromAssembly(string assemblyName)
        {
            // Load assembly
            Assembly assembly = Assembly.LoadFrom(assemblyName);

            // Find benchmark suites
            foreach (Type type in assembly.GetTypes())
            {
                if (type.IsSubclassOf(typeof(BenchmarkSuite)) && !type.IsAbstract)
                {
                    BenchmarkSuite suite    = Activator.CreateInstance(type) as BenchmarkSuite;
                    var            instance = new BenchmarkSuiteInstance(suite);
                    _suites.Add(instance);
                    _parameters.AddSuite(instance);
                }
            }
        }
        private static void DoBenchmark()
        {
            BenchmarkSuite testSuite = new BenchmarkSuite();

            testSuite.OnTestMethodCompleted += Report;

            try
            {
                foreach (var session in History)
                {
                    if (Cancellation.IsCancellationRequested)
                    {
                        break;
                    }

                    CurrentSession = session;

                    CurrentStatus = String.Format("{0} Init...", session.Database.Name);
                    testSuite.ExecuteInit(session);

                    CurrentStatus = String.Format("{0} Write...", session.Database.Name);
                    CurrentMethod = TestMethod.Write;
                    testSuite.ExecuteWrite(session);

                    CurrentStatus = String.Format("{0} Read...", session.Database.Name);
                    CurrentMethod = TestMethod.Read;
                    testSuite.ExecuteRead(session);

                    CurrentStatus = String.Format("{0} Secondary Read...", session.Database.Name);
                    CurrentMethod = TestMethod.SecondaryRead;
                    testSuite.ExecuteSecondaryRead(session);

                    testSuite.ExecuteFinish(session);
                }
            }
            finally
            {
                Console.Title = "Tests finished.";

                if (Cancellation.IsCancellationRequested)
                {
                    History.Clear();
                }
            }
        }
Пример #10
0
        public void LoadSuitesFromAssembly(string assemblyName)
        {
            Runner.Process.Stop();

            // Load assembly
            Assembly assembly = Assembly.LoadFrom(assemblyName);

            // Find benchmark suites
            foreach (Type type in assembly.GetTypes())
            {
                if (type.IsSubclassOf(typeof(BenchmarkSuite)) && !type.IsAbstract)
                {
                    BenchmarkSuite suite    = Activator.CreateInstance(type) as BenchmarkSuite;
                    var            instance = new BenchmarkSuiteInstance(suite);
                    _suites.Add(instance);
                    Runner.ConfigurationManager.AddSuite(instance);
                }
            }
        }
Пример #11
0
        private void DoBenchmark()
        {
            CurrentTest = new BenchmarkSuite();
            CurrentTest.ExecuteTests(TableCount, RecordCount, Randomness, Cancellation, Test);

            // TODO: Fix this.
            //testSuite.OnTestMethodCompleted += Report;
            //testSuite.OnException += OnException;

            try
            {
                foreach (var benchmark in History)
                {
                    if (Cancellation.IsCancellationRequested)
                        break;

                    //Current = benchmark;
                    //testSuite.ExecuteInit(benchmark);

                    //// Write.
                    //MainLayout.SetCurrentMethod(TestMethod.Write);
                    //CurrentStatus = TestMethod.Write.ToString();

                    //testSuite.ExecuteWrite(benchmark);

                    //// Read.
                    //MainLayout.SetCurrentMethod(TestMethod.Read);
                    //CurrentStatus = TestMethod.Read.ToString();

                    //testSuite.ExecuteRead(benchmark);

                    //// Secondary Read.
                    //MainLayout.SetCurrentMethod(TestMethod.SecondaryRead);
                    //CurrentStatus = TestMethod.SecondaryRead.ToString();

                    //testSuite.ExecuteSecondaryRead(benchmark);

                    //// Finish.
                    //CurrentStatus = TestMethod.None.ToString();
                    //testSuite.ExecuteFinish(benchmark);
                }
            }
            finally
            {
                Current = null;

                if (Cancellation.IsCancellationRequested)
                    History.Clear();
                else
                {
                    if (!TestFailed)
                    {
                        if (!Settings.Default.HideReportForm)
                            OnlineReport();
                    }
                }
            }
        }
 public BenchmarkBuilder AddSuite(BenchmarkSuite suite)
 {
     this._runner.Benchmarks.AddSuite(suite);
     return(this);
 }
Пример #13
0
        public void AddSuite(BenchmarkSuite suite)
        {
            var instance = new BenchmarkSuiteInstance(suite);

            AddSuite(instance);
        }
Пример #14
0
 public void RemoveSuite(BenchmarkSuite suite)
 {
     SuiteManager.RemoveSuite(suite);
 }
Пример #15
0
 public void AddSuite(BenchmarkSuite suite)
 {
     SuiteManager.AddSuite(suite);
 }
Пример #16
0
        private void DoBenchmark()
        {
            BenchmarkSuite testSuite = new BenchmarkSuite();
            testSuite.OnTestFinish += Report;

            try
            {
                foreach (var benchmark in History)
                {
                    if (Cancellation.IsCancellationRequested)
                        break;

                    Current = benchmark;
                    testSuite.ExecuteInit(benchmark);

                    // Write.
                    ApplicationManager.SetCurrentMethod(TestMethod.Write);
                    CurrentStatus = TestMethod.Write.ToString();

                    testSuite.ExecuteWrite(benchmark);

                    // Read.
                    ApplicationManager.SetCurrentMethod(TestMethod.Read);
                    CurrentStatus = TestMethod.Read.ToString();

                    testSuite.ExecuteRead(benchmark);

                    // Secondary Read.
                    ApplicationManager.SetCurrentMethod(TestMethod.SecondaryRead);
                    CurrentStatus = TestMethod.SecondaryRead.ToString();

                    testSuite.ExecuteSecondaryRead(benchmark);

                    // Finish.
                    CurrentStatus = TestMethod.None.ToString();
                    testSuite.ExecuteFinish(benchmark);
                }
            }
            finally
            {
                Current = null;

                if (Cancellation.IsCancellationRequested)
                    History.Clear();
                else
                {
                    if (!(bool)Properties.Settings.Default["HideReportForm"])
                        StartOnlineReport();
                }
            }
        }