コード例 #1
0
ファイル: MainForm.cs プロジェクト: wondial/DatabaseBenchmark
        private void startButton_Click(object sender, EventArgs e)
        {
            // Parse test parameters.
            TableCount  = Int32.Parse(cbFlowsCount.Text.Replace(" ", ""));
            RecordCount = Int64.Parse(cbRecordCount.Text.Replace(" ", ""));
            Randomness  = trackBar1.Value / 20.0f;

            MainLayout.InitializeCharts(MainLayout.GetSelectedDatabasesChartValues());

            if (MainLayout.TreeView.GetSelectedDatabases().Length == 0 && MainLayout.TreeView.GetSelectedDatabase() == null)
            {
                return;
            }

            History.Clear();
            Cancellation = new CancellationTokenSource();

            foreach (var database in MainLayout.TreeView.GetSelectedDatabases())
            {
                // TODO: Fix this.
                //var session = new BenchmarkSession(database, TableCount, RecordCount, Randomness, Cancellation);
                //History.Add(session);

                //Test = new FullWriteReadTest(database, TableCount, RecordCount, Randomness, Cancellation);
                DirectoryUtils.ClearDatabaseDataDirectory(database);
            }

            MainLayout.ClearLogFrame();

            // Start the benchmark.
            MainTask = Task.Factory.StartNew(DoBenchmark, Cancellation.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
        }