diff --git a/ctl/ctlSQLGrid.cpp b/ctl/ctlSQLGrid.cpp index 6c83303..86ea462 100644 --- a/ctl/ctlSQLGrid.cpp +++ b/ctl/ctlSQLGrid.cpp @@ -1227,6 +1227,7 @@ int recurse(ctlSQLGrid* g, int pos, int row, double& transfer) { wxString text; double leveltime = 0; //actual time level double lastnode = 0; + double plan=0; while (row < g->GetNumberRows()) { text = g->GetCellValue(row, 0); int p = 0; @@ -1263,6 +1264,35 @@ int recurse(ctlSQLGrid* g, int pos, int row, double& transfer) { else { g->grp->ColoriseRow(row, wxColour(224, 255, 224)); // green + // end section + if (g->grp->endsectionrow==-1 && p==0 && pos==0) { + wxRegEx foundstr(wxT("Planning Time: ([0-9.]+)"), wxRE_ADVANCED); + if (foundstr.Matches(text)) { + wxString v = foundstr.GetMatch(text, 1); + v.ToCDouble(&plan); + g->grp->SetTimeToRow(row,plan); + g->grp->endsectionrow=row; + } + + } + if (g->grp->endsectionrow!=-1 && p==0 && pos==0) { + //Planning Time: 1.919 ms + wxRegEx foundstr(wxT("time=([0-9.]+)"), wxRE_ADVANCED); + double currtime=0; + if (foundstr.Matches(text)) { + wxString v = foundstr.GetMatch(text, 1); + v.ToCDouble(&currtime); + g->grp->SetTimeToRow(row,currtime); + } else { + wxRegEx foundstr(wxT("Execution Time: ([0-9.]+)"), wxRE_ADVANCED); + double totalexecute=0; + if (foundstr.Matches(text)) { + wxString v = foundstr.GetMatch(text, 1); + v.ToCDouble(&totalexecute); + g->grp->endsectiontotal=totalexecute; + } + } + } g->GetTable()->SetRowLabelValue(row, wxEmptyString); } row++; @@ -1280,8 +1310,10 @@ int recurse(ctlSQLGrid* g, int pos, int row, double& transfer) { // //leveltime=leveltime+transfer; //GroupRows *u=g->getgroup(); + // Вычисляется чистое время узла без учёта времени вложенного double tt = lastnode - transfer; text = g->GetCellValue(row - 1, 0); + // эти узлы будут показывать полное время с учётом вложеннных if ((text.Find("Append") > 0) || (text.Find("Gather") > 0)) tt = lastnode; diff --git a/include/ctl/ctlSQLGrid.h b/include/ctl/ctlSQLGrid.h index 4be5005..fc91f93 100644 --- a/include/ctl/ctlSQLGrid.h +++ b/include/ctl/ctlSQLGrid.h @@ -104,7 +104,16 @@ public: end.Add(-1, g->GetNumberRows()); run.Clear(); run.Add(0.0, g->GetNumberRows()); + endsectionrow=-1; + endsectiontotal=0; }; + /** + * @brief Определяет строчный диапазон узла и время его выполнения + * + * @param rowgroup Начальная строка узла со знаком -> + * @param lastrowgroup Последняя строка узла + * @param actualtime Время выполнения узла + */ void AddGroup(int rowgroup, int lastrowgroup, double actualtime) { // default group open rowsGroup[rowgroup] = -rowgroup; @@ -113,6 +122,18 @@ public: end[rowgroup] = lastrowgroup; run[rowgroup] = actualtime; }; + void SetTimeToRow(int row, double actualtime) { + // default group open + //beg[rowgroup]=rowgroup; + //wxASSERT_MSG(lastrowgroup > end.Count(), " out of bounds"); + run[row] = actualtime; + }; + /** + * @brief Скрывает или показывает узел плана + * + * @param row начальная строка узла + * @param visible + */ void VisibleGroup(int row, bool visible) { int endg = end[row]; int grp = IsGroupRow(row); @@ -173,6 +194,12 @@ public: pAttr->SetBackgroundColour(color); g->SetRowAttr(row, pAttr); }; + /** + * @brief Подсчёт времени всех узлов. Начиная со строки endsectionrow + * считается время планирования и выполнения триггеров. + * Эти расчёты не связаны с проценьами по узлам плана. + * + */ void CalcTime() { //g->GetTable()->SetRowLabelValue(row-1,s); double sum = 0; @@ -186,15 +213,20 @@ public: else { wxString str; - if (total == 0 || t == 0) { - str = ""; - } - else + if (i>=endsectionrow && endsectionrow!=-1) { - - t = (t / total) * 100; - str.Printf(wxT("%5.2f"), t); + total=endsectiontotal; + if (i==endsectionrow) total+=t; // % plan = plan time / (plan time + execute time) } + + if (total == 0 || t == 0) { + str = ""; + } + else + { + t = (t / total) * 100; + str.Printf(wxT("%5.2f"), t); + } g->GetTable()->SetRowLabelValue(i, str); } @@ -202,7 +234,8 @@ public: }; - +int endsectionrow; // start section after Planning time; +double endsectiontotal; // value Execution Time: private: ctlSQLGrid* g; wxArrayInt rowsGroup, end;