private void Start() { //primary_secondary.GetPerfPointData(@"C:\AGLatency\AGLatency\bin\Debug\Primary_To_Secondary_2__2018-08-02_21_47_45.791.SQLiteDB"); //cleanup db, create db mapping XELoader.Reset(); Controller.Reset(); //delete files in the sqldb folder SQLiteDB.DeleteOldFile(); string outputPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/Report"; //Set this path here, otherwise the output won't work PageTemplate.HtmlPageOutput.reportOutputFolder = Path.Combine(outputPath, System.DateTime.Now.ToString("yyyy-MM-dd_HH_mm_ss")); if (!Directory.Exists(PageTemplate.HtmlPageOutput.reportOutputFolder)) { Directory.CreateDirectory(PageTemplate.HtmlPageOutput.reportOutputFolder); } Utility.CopyHtmlFiles(PageTemplate.HtmlPageOutput.reportOutputFolder); Logger.LogMessage("Output folder:" + PageTemplate.HtmlPageOutput.reportOutputFolder); primary_log_flush = new Latency.LogBlockLocalHarden(Replica.Primary); secondary_log_flush = new Latency.LogBlockLocalHarden(Replica.Secondary); primary_secondary = new Latency.NetworkLatency(NetworkDirection.Primary_To_Secondary); logCapturePrimary = new Latency.LogCapturePrimary(); syncReceiveNetLatency = new Latency.SyncReceiveNetLatency(NetworkDirection.Secondary_To_Primary); dbFlowControl = new Latency.DBFlowControl(); //Register to XELoader primary_log_flush.Register(); secondary_log_flush.Register(); primary_secondary.Register(); logCapturePrimary.Register(); syncReceiveNetLatency.Register(); dbFlowControl.Register(); // Latency.LogBlockLocalHarden.GeneratePerfMonCSV(@"C:\AGLatency\AGLatency\bin\Debug\SQLiteDB\LocalHarden_Primary_perf.CSV"); Logger.LogMessage("Start..."); //SQLiteDB lite = new SQLiteDB(); //lite.Init("test"); //lite.Execute("create table highscores (name varchar(20), score int)"); Logger.LogMessage("Primary:" + this.textBox1.Text); Logger.LogMessage("Secondary:" + this.textBox2.Text); xel = new XELoader(this.textBox1.Text, Replica.Primary, UpdateProgress1); mythread = new Thread(xel.Start); // Thread.Sleep(1000);//wait for one second to avoid duplicate filename xel2 = new XELoader(this.textBox2.Text, Replica.Secondary, UpdateProgress2); td1 = new Thread(xel.GetTotalEventCount); td2 = new Thread(xel2.GetTotalEventCount); td1.Start(); td2.Start(); //start another thread otherwise it will block the main UI thread Thread proProcess = new Thread(PreProcessing); proProcess.Start(); }
private void Start() { //primary_secondary.GetPerfPointData(@"C:\AGLatency\AGLatency\bin\Debug\Primary_To_Secondary_2__2018-08-02_21_47_45.791.SQLiteDB"); //cleanup db, create db mapping XELoader.Reset(); Controller.Reset(); //delete files in the sqldb folder SQLiteDB.DeleteOldFile(); string outputPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/Report"; //Set this path here, otherwise the output won't work PageTemplate.HtmlPageOutput.reportOutputFolder = Path.Combine(outputPath, System.DateTime.Now.ToString("yyyy-MM-dd_HH_mm_ss")); if (!Directory.Exists(PageTemplate.HtmlPageOutput.reportOutputFolder)) { Directory.CreateDirectory(PageTemplate.HtmlPageOutput.reportOutputFolder); } Utility.CopyHtmlFiles(PageTemplate.HtmlPageOutput.reportOutputFolder); Logger.LogMessage("Output folder:" + PageTemplate.HtmlPageOutput.reportOutputFolder); /* * primary_log_flush = new Latency.LogBlockLocalHarden(Replica.Primary); * secondary_log_flush = new Latency.LogBlockLocalHarden(Replica.Secondary); * * //Ignore it now * //primary_secondary = new Latency.NetworkLatency(NetworkDirection.Primary_To_Secondary); * * logCapturePrimary = new Latency.LogCapturePrimary(); * * //Ignore it now * //syncReceiveNetLatency = new Latency.SyncReceiveNetLatency(NetworkDirection.Secondary_To_Primary); */ // dbFlowControl = new Latency.DBFlowControl(); /* * tranRemoteCommit = new Latency.TranRemoteCommit(); * tranProcessing = new Latency.TranProcessingTime(); * //Register to XELoader * primary_log_flush.Register(); * secondary_log_flush.Register(); * * //Ignore it now * //primary_secondary.Register(); * //syncReceiveNetLatency.Register(); * * logCapturePrimary.Register(); * * tranRemoteCommit.Register(); * tranProcessing.Register(); * * dbFlowControl.Register(); */ // Latency.LogBlockLocalHarden.GeneratePerfMonCSV(@"C:\AGLatency\AGLatency\bin\Debug\SQLiteDB\LocalHarden_Primary_perf.CSV"); bool IsPrimary = true; hadr_log_block_send_complete = new Latency.EventProcessingTemplate(IsPrimary, "total_processing_time", EventMetaData.xEvent.hadr_log_block_send_complete); hadr_db_commit_mgr_harden = new Latency.EventProcessingTemplate(IsPrimary, "time_to_commit", EventMetaData.xEvent.hadr_db_commit_mgr_harden); recovery_unit_harden_log_timestamps = new Latency.EventProcessingTemplate(IsPrimary, "processing_time", EventMetaData.xEvent.recovery_unit_harden_log_timestamps); log_flush_complete = new Latency.EventProcessingTemplate(IsPrimary, "duration", EventMetaData.xEvent.log_flush_complete); log_flush_complete_secondary = new Latency.EventProcessingTemplate(!IsPrimary, "duration", EventMetaData.xEvent.log_flush_complete); hadr_log_block_compression = new Latency.EventProcessingTemplate(IsPrimary, "processing_time", EventMetaData.xEvent.hadr_log_block_compression); hadr_receive_harden_lsn_message = new Latency.EventProcessingTemplate(IsPrimary, "processing_time", EventMetaData.xEvent.hadr_receive_harden_lsn_message, 2); hadr_database_flow_control_action = new Latency.EventProcessingTemplate(IsPrimary, "duration", EventMetaData.xEvent.hadr_database_flow_control_action); hadr_log_block_decompression = new Latency.EventProcessingTemplate(!IsPrimary, "processing_time", EventMetaData.xEvent.hadr_log_block_decompression); hadr_transport_receive_log_block_message = new Latency.EventProcessingTemplate(!IsPrimary, "processing_time", EventMetaData.xEvent.hadr_transport_receive_log_block_message, 2); hadr_lsn_send_complete = new Latency.EventProcessingTemplate(!IsPrimary, "total_sending_time", EventMetaData.xEvent.hadr_lsn_send_complete); hadr_lsn_send_complete2 = new Latency.EventProcessingTemplate(!IsPrimary, "total_processing_time", EventMetaData.xEvent.hadr_lsn_send_complete); Logger.LogMessage("Start..."); //SQLiteDB lite = new SQLiteDB(); //lite.Init("test"); //lite.Execute("create table highscores (name varchar(20), score int)"); Logger.LogMessage("Primary:" + this.textBox1.Text); Logger.LogMessage("Secondary:" + this.textBox2.Text); xel = new XELoader(this.textBox1.Text, Replica.Primary, UpdateProgress1); mythread = new Thread(xel.Start); // Thread.Sleep(1000);//wait for one second to avoid duplicate filename xel2 = new XELoader(this.textBox2.Text, Replica.Secondary, UpdateProgress2); td1 = new Thread(xel.GetTotalEventCount); td2 = new Thread(xel2.GetTotalEventCount); td1.Start(); td2.Start(); //start another thread otherwise it will block the main UI thread Thread proProcess = new Thread(PreProcessing); proProcess.Start(); }
public EventLatency(string dbname) { eventDB = new SQLiteDB(); eventDB.Init(dbname); }