コード例 #1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtAddress.Text))
            {
                return;
            }

            BenchRunnerOptions option = CreateOptions();
            var          runner       = new BenchRunner(txtApacheBenchFileName.Text);
            WorkerParams p            = new WorkerParams(runner, option);

            _singleTestWorker.RunWorkerAsync(p);
        }
コード例 #2
0
        private void btnRedoAllTests_Click(object sender, EventArgs e)
        {
            if (_allTestsWorker.IsBusy)
            {
                _allTestsWorker.CancelAsync();
                btnRedoAllTests.Text = "Run all tests";
                return;
            }

            if (Archive.Results.Count() > 0)
            {
                runningProgressBar.Value   = 0;
                runningProgressBar.Maximum = 100;

                btnRedoAllTests.Text = "Stop";
                var runner = new BenchRunner(txtApacheBenchFileName.Text);
                _allTestsWorker.RunWorkerAsync(runner);
            }
        }
コード例 #3
0
        void AllTestsWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            double           step   = 100.0 / this.Archive.Results.Count();
            BenchRunner      runner = (BenchRunner)e.Argument;
            BackgroundWorker worker = (BackgroundWorker)sender;

            int nCount = 0;

            foreach (var test in this.Archive.Results)
            {
                if (worker.CancellationPending)
                {
                    break;
                }

                nCount++;
                runner.Update(test);
                worker.ReportProgress((int)(nCount * step));
            }

            worker.ReportProgress(0);
        }
コード例 #4
0
 public WorkerParams(BenchRunner runner, BenchRunnerOptions options)
 {
     Runner  = runner;
     Options = options;
 }