Esempio n. 1
0
        private void go_button_Click(object sender, EventArgs e)
        {
            if (!_settings.MainDbConnectionInfo.TestConnection())
            {
                MessageBox.Show(Resources.MustSetValidDbConnInfo);
                return;
            }

            _testStartTime       = DateTime.Now;
            _testGuid            = Guid.NewGuid();
            _cancelled           = false;
            _exitOnComplete      = false;
            _backgroundWorkerCTS = new System.Threading.CancellationTokenSource();

            _exceptions = new Dictionary <string, int>();

            _totalIterations   = 0;
            _activeThreads     = 0;
            _totalTime         = 0;
            _totalCpuTime      = 0;
            _totalElapsedTime  = 0;
            _totalTimeMessages = 0;
            _totalLogicalReads = 0;
            _totalReadMessages = 0;
            _totalExceptions   = 0;

            iterationsSecond_textBox.Text    = @"0";
            avgSeconds_textBox.Text          = @"0.0";
            actualSeconds_textBox.Text       = Dashes;
            cpuTime_textBox.Text             = Dashes;
            logicalReads_textBox.Text        = Dashes;
            go_button.Enabled                = false;
            cancel_button.Enabled            = true;
            iterations_numericUpDown.Enabled = false;
            threads_numericUpDown.Enabled    = false;
            queryDelay_textBox.Enabled       = false;

            progressBar1.Value = 0;

            SaveSettingsFromForm1();

            _totalExpectedIterations = _settings.NumThreads * _settings.NumIterations;

            var paramConnectionInfo = _settings.ShareDbSettings ? _settings.MainDbConnectionInfo : _settings.ParamDbConnectionInfo;

            db_label.Text = $@"Server: {paramConnectionInfo.Server}{(paramConnectionInfo.Database.Length > 0 ? "  //  Database: " + paramConnectionInfo.Database : string.Empty)}";

            var engine = new LoadEngine(_settings.MainDbConnectionInfo.ConnectionString, _settings.MainQuery, _settings.NumThreads, _settings.NumIterations,
                                        _settings.ParamQuery, _settings.ParamMappings, paramConnectionInfo.ConnectionString, _settings.CommandTimeout, _settings.CollectIoStats,
                                        _settings.CollectTimeStats, _settings.ForceDataRetrieval, _settings.KillQueriesOnCancel, _backgroundWorkerCTS);

            backgroundWorker1.RunWorkerAsync(engine);

            _start = new TimeSpan(DateTime.Now.Ticks);

            mainUITimer.Start();
        }
Esempio n. 2
0
        private void btnFreeCache_Click(object sender, EventArgs e)
        {
            if (!_settings.MainDbConnectionInfo.TestConnection())
            {
                MessageBox.Show(Resources.MustSetValidDbConnInfo);
                return;
            }

            MessageBox.Show(LoadEngine.ExecuteCommand(_settings.MainDbConnectionInfo.ConnectionString, "DBCC FREEPROCCACHE")
                ? "Cache freed"
                : "Errors encountered");
        }
Esempio n. 3
0
        private void btnCleanBuffer_Click(object sender, EventArgs e)
        {
            if (!_settings.MainDbConnectionInfo.TestConnection())
            {
                MessageBox.Show(Resources.MustSetValidDbConnInfo);
                return;
            }

            MessageBox.Show(LoadEngine.ExecuteCommand(_settings.MainDbConnectionInfo.ConnectionString, "DBCC DROPCLEANBUFFERS")
                ? "Buffers cleared"
                : "Errors encountered");
        }
Esempio n. 4
0
 private void btnFreeCache_Click(object sender, EventArgs e)
 {
     MessageBox.Show(LoadEngine.ExecuteCommand(_settings.MainDbConnectionInfo.ConnectionString, "DBCC FREEPROCCACHE")
         ? "Cache freed"
         : "Errors encountered");
 }
Esempio n. 5
0
 private void btnCleanBuffer_Click(object sender, EventArgs e)
 {
     MessageBox.Show(LoadEngine.ExecuteCommand(_settings.MainDbConnectionInfo.ConnectionString, "DBCC DROPCLEANBUFFERS")
         ? "Buffers cleared"
         : "Errors encountered");
 }
Esempio n. 6
0
        private void go_button_Click(object sender, EventArgs e)
        {
            if (!_settings.MainDbConnectionInfo.TestConnection())
            {
                MessageBox.Show(Resources.MustSetValidDbConnInfo);
                return;
            }

            _cancelled = false;
            _exitOnComplete = false;

            _exceptions = new Dictionary<string, int>();

            _totalIterations = 0;
            _totalTime = 0;
            _totalCpuTime = 0;
            _totalElapsedTime = 0;
            _totalTimeMessages = 0;
            _totalLogicalReads = 0;
            _totalReadMessages = 0;
            _totalExceptions = 0;

            iterationsSecond_textBox.Text = "0";
            avgSeconds_textBox.Text = "0.0";
            actualSeconds_textBox.Text = Dashes;
            cpuTime_textBox.Text = Dashes;
            logicalReads_textBox.Text = Dashes;
            go_button.Enabled = false;
            cancel_button.Enabled = true;
            iterations_numericUpDown.Enabled = false;
            threads_numericUpDown.Enabled = false;

            progressBar1.Value = 0;

            SaveSettingsFromForm1();

            _totalExpectedIterations = _settings.NumThreads * _settings.NumIterations;

            var paramConnectionInfo = _settings.ShareDbSettings ? _settings.MainDbConnectionInfo : _settings.ParamDbConnectionInfo;
            db_label.Text = "" + "Server: " + paramConnectionInfo.Server +
                            (paramConnectionInfo.Database.Length > 0 ? "  //  Database: " + paramConnectionInfo.Database : "");

            var engine = new LoadEngine(_settings.MainDbConnectionInfo.ConnectionString, _settings.MainQuery, _settings.NumThreads, _settings.NumIterations,
                _settings.ParamQuery, _settings.ParamMappings, paramConnectionInfo.ConnectionString, _settings.CommandTimeout, _settings.CollectIoStats,
                _settings.CollectTimeStats, _settings.ForceDataRetrieval);
            backgroundWorker1.RunWorkerAsync(engine);

            _start = new TimeSpan(DateTime.Now.Ticks);

            mainUITimer.Start();
        }
Esempio n. 7
0
        private void go_button_Click(object sender, EventArgs e)
        {
            if (!this.settings.mainDBConnectionInfo.TestConnection())
            {
                MessageBox.Show("You must set valid database connection information. Click the Database button to configure the settings.");
                return;
            }

            this.cancelled = false;
            this.exitOnComplete = false;

            this.exceptions = new Dictionary<string,int>();

            this.totalIterations = 0;
            this.totalTime = 0;
            this.totalCPUTime = 0;
            this.totalElapsedTime = 0;
            this.totalTimeMessages = 0;
            this.totalLogicalReads = 0;
            this.totalReadMessages = 0;
            this.totalExceptions = 0;

            this.iterationsSecond_textBox.Text = "0";
            this.avgSeconds_textBox.Text = "0.0";
            this.actualSeconds_textBox.Text = "---";
            this.cpuTime_textBox.Text = "---";
            this.logicalReads_textBox.Text = "---";
            this.go_button.Enabled = false;
            this.cancel_button.Enabled = true;
            this.iterations_numericUpDown.Enabled = false;
            this.threads_numericUpDown.Enabled = false;

            this.progressBar1.Value = 0;

            SaveSettingsFromForm1();

            this.totalExpectedIterations = this.settings.numThreads * this.settings.numIterations;

            DatabaseSelect.ConnectionInfo paramConnectionInfo = settings.shareDBSettings ? settings.mainDBConnectionInfo : settings.paramDBConnectionInfo;
            db_label.Text = "" +
                "Server: " + paramConnectionInfo.Server +
                ((paramConnectionInfo.Database.Length > 0) ? ("  //  Database: " + paramConnectionInfo.Database) : (""));

            LoadEngine engine = new LoadEngine(
                this.settings.mainDBConnectionInfo.ConnectionString,
                this.settings.mainQuery,
                this.settings.numThreads,
                this.settings.numIterations,
                this.settings.paramQuery,
                this.settings.paramMappings,
                paramConnectionInfo.ConnectionString,
                this.settings.commandTimeout,
                this.settings.collectIOStats,
                this.settings.collectTimeStats,
                this.settings.forceDataRetrieval);
            backgroundWorker1.RunWorkerAsync(engine);

            this.start = new TimeSpan(DateTime.Now.Ticks);

            mainUITimer.Start();
        }
Esempio n. 8
0
        private void go_button_Click(object sender, EventArgs e)
        {
            if (!this.settings.mainDBConnectionInfo.TestConnection())
            {
                MessageBox.Show("You must set valid database connection information. Click the Database button to configure the settings.");
                return;
            }

            this.cancelled      = false;
            this.exitOnComplete = false;

            this.exceptions = new Dictionary <string, int>();

            this.totalIterations   = 0;
            this.totalTime         = 0;
            this.totalCPUTime      = 0;
            this.totalElapsedTime  = 0;
            this.totalTimeMessages = 0;
            this.totalLogicalReads = 0;
            this.totalReadMessages = 0;
            this.totalExceptions   = 0;

            this.iterationsSecond_textBox.Text    = "0";
            this.avgSeconds_textBox.Text          = "0.0";
            this.actualSeconds_textBox.Text       = "---";
            this.cpuTime_textBox.Text             = "---";
            this.logicalReads_textBox.Text        = "---";
            this.go_button.Enabled                = false;
            this.cancel_button.Enabled            = true;
            this.iterations_numericUpDown.Enabled = false;
            this.threads_numericUpDown.Enabled    = false;

            this.progressBar1.Value = 0;

            SaveSettingsFromForm1();

            this.totalExpectedIterations = this.settings.numThreads * this.settings.numIterations;

            DatabaseSelect.ConnectionInfo paramConnectionInfo = settings.shareDBSettings ? settings.mainDBConnectionInfo : settings.paramDBConnectionInfo;
            db_label.Text = "" +
                            "Server: " + paramConnectionInfo.Server +
                            ((paramConnectionInfo.Database.Length > 0) ? ("  //  Database: " + paramConnectionInfo.Database) : (""));

            LoadEngine engine = new LoadEngine(
                this.settings.mainDBConnectionInfo.ConnectionString,
                this.settings.mainQuery,
                this.settings.numThreads,
                this.settings.numIterations,
                this.settings.paramQuery,
                this.settings.paramMappings,
                paramConnectionInfo.ConnectionString,
                this.settings.commandTimeout,
                this.settings.collectIOStats,
                this.settings.collectTimeStats,
                this.settings.forceDataRetrieval);

            backgroundWorker1.RunWorkerAsync(engine);

            this.start = new TimeSpan(DateTime.Now.Ticks);

            mainUITimer.Start();
        }