void BtnRunClick(object sender, EventArgs e) { BtnRun.Enabled = false; int max = Convert.ToInt32(numThreads.Value); ArrayList lst_threads = new ArrayList(); LstThreads.Items.Clear(); for (int t = 1; t <= max; ++t) { ListViewItem item = new ListViewItem(); item.SubItems[0].Text = t.ToString(); item.SubItems.Add("0.00 %"); item.SubItems.Add("0,0 ms"); item.SubItems.Add("00:00:00"); LstThreads.Items.Add(item); LoadThread myLoadThread = new LoadThread(connString, ref item, t, TxtTransaction.Text); lst_threads.Add(myLoadThread); } lst_runs.Add(lst_threads); for (int t = 0; t < lst_threads.Count; ++t) { LoadThread myLoadThread = lst_threads [t] as LoadThread; myLoadThread.Run(); } }
public bool IsFinished() { if (lst_runs.Count == indexRun) { return(false); } ArrayList lst_threads = lst_runs [indexRun] as ArrayList; if (lst_threads == null) { return(false); } bool IsDone = true; for (int t = 0; t < lst_threads.Count; ++t) { LoadThread myLoadThread = lst_threads [t] as LoadThread; if (!myLoadThread.StopTimer) { IsDone = false; break; } } return(IsDone); }
public void UpdateReport() { ArrayList lst_threads = lst_runs [indexRun] as ArrayList; double total = 0; double lowest = 0; double avg = 0; ListViewItem var_item = null; for (int t = 0; t < lst_threads.Count; ++t) { LoadThread myLoadThread = lst_threads [t] as LoadThread; double tmp = Convert.ToDouble(myLoadThread.var_lstResults.Tag); if (lowest < tmp) { lowest = tmp; var_item = myLoadThread.var_lstResults; } total += tmp; } avg = total / lst_threads.Count; ListViewItem item = new ListViewItem(); item.SubItems[0].Text = lst_threads.Count.ToString(); item.SubItems.Add(String.Format("{0:n}", lowest)); // Lowest item.SubItems.Add(String.Format("{0:n}", avg)); // Average item.SubItems.Add(var_item.SubItems[3].Text); // Max Time LstReport.Items.Add(item); BtnRun.Enabled = true; indexRun++; }