private void LoadDefaultConfig() { string defaultConfig = ConfigurationSettings.AppSettings["DefaultConfigFile"]; if (defaultConfig != null) { if (File.Exists(defaultConfig)) { FileInfo info = new FileInfo(defaultConfig); try { this.bindingSource.Clear(); this.bindingSource.Add(BenchMarkConfiguration.Load(info.FullName)); // Set the second TAB as the active this.tabBenchmark.SelectedTab = this.tabRun; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error loading config file"); } } } }
private void cmdLoad_Click(object sender, System.EventArgs e) { OpenFileDialog openDlg = new OpenFileDialog(); openDlg.Filter = "Archivos Config (*.config)|*.config|" + "All files (*.*)|*.*"; openDlg.ShowDialog(); this.Refresh(); string fileName = openDlg.FileName; if (fileName != null && fileName.Length > 0) { try { FileInfo info = new FileInfo(fileName); this.bindingSource.Clear(); this.bindingSource.Add(BenchMarkConfiguration.Load(info.FullName)); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error loading config file"); } } }
public AS3AP(string logPath, BenchMarkConfiguration configuration) { this.configuration = configuration; this.logPath = logPath; if (!this.logPath.EndsWith(Path.DirectorySeparatorChar.ToString())) { this.logPath += Path.DirectorySeparatorChar; } string logName = this.logPath + "as3ap_" + System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString() + ".log"; if (configuration.EnableLogging) { this.log = new Logger(logName, Mode.OVERWRITE); } testSuite = TestSuiteFactory.GetTestSuite(testSuiteType, configuration); testSuite.Log = log; testSuite.Result += new ResultEventHandler(OnResult); testSuite.Progress += new ProgressEventHandler(OnProgress); }
public static BenchMarkConfiguration Load(string fileName) { try { BenchMarkConfiguration configuration; // test if file exists. if (File.Exists(fileName)) { // read back serialized objectinstance FileStream output = new FileStream(fileName, FileMode.Open); SoapFormatter formatter = new SoapFormatter(); configuration = (BenchMarkConfiguration)formatter.Deserialize(output); output.Close(); } else { // return new instance configuration = new BenchMarkConfiguration(); } return(configuration); } catch { // General error, bubble throw; } }
public static ITestSuite GetTestSuite(string name, BenchMarkConfiguration configuration) { switch (name) { case "SQL87": return(new Sql87TestSuite(configuration)); case "SQL92": return(new Sql92TestSuite(configuration)); } return(null); }
private void RunBenchMark() { try { BenchMarkConfiguration configuration = (BenchMarkConfiguration)bindingSource.Current; this.as3ap = new AS3AP(Path.GetDirectoryName(Application.ExecutablePath), configuration); // Test Result Event handler this.testResultHandler = new TestResultEventHandler(OnTestResult); this.as3ap.TestResult += this.testResultHandler; // Progress Message Event handler this.progressMessageHandler = new ProgressMessageEventHandler(OnProgressMessage); this.as3ap.ProgressMessage += this.progressMessageHandler; this.as3ap.Run(); } catch (ThreadAbortException) { } catch (Exception ex) { StringBuilder e = new StringBuilder(); e.AppendFormat("Message: \r\n {0} \r\n StackTrace: \r\n {1}", ex.Message, ex.StackTrace); MessageBox.Show(e.ToString(), "AS3AP Benchmark - Exception"); } finally { if (this.testResultHandler != null) { this.as3ap.TestResult -= testResultHandler; } if (this.progressMessageHandler != null) { this.as3ap.ProgressMessage -= progressMessageHandler; } if (this.as3ap != null) { this.as3ap.Dispose(); this.as3ap = null; } } }
private void cmdSave_Click(object sender, System.EventArgs e) { SaveFileDialog saveDlg = new SaveFileDialog(); saveDlg.Filter = "Archivos Config (*.config)|*.config|" + "All files (*.*)|*.*"; saveDlg.ShowDialog(); this.Refresh(); string fileName = saveDlg.FileName; if (fileName != null && fileName.Length > 0) { FileInfo info = new FileInfo(fileName); BenchMarkConfiguration configuration = (BenchMarkConfiguration)bindingSource.Current; configuration.Save(info.FullName); } }
public Sql87TestSuite(BenchMarkConfiguration configuration) : base(configuration) { this.testSuiteName = "SQL87"; }