diff --git a/core/displayablegraph.class.inc.php b/core/displayablegraph.class.inc.php index cf354f135..f231fd9da 100644 --- a/core/displayablegraph.class.inc.php +++ b/core/displayablegraph.class.inc.php @@ -864,6 +864,7 @@ class DisplayableGraph extends SimpleGraph */ public static function FromRelationGraph(RelationGraph $oGraph, $iGroupingThreshold = 20, $bDirectionDown = true, $bForPdf = false) { + $oKPI = new ExecutionKPI(); $oNewGraph = new DisplayableGraph(); $oNewGraph->bDirectionDown = $bDirectionDown; $iPreviousTimeLimit = ini_get('max_execution_time'); @@ -1017,6 +1018,7 @@ class DisplayableGraph extends SimpleGraph } set_time_limit(intval($iPreviousTimeLimit)); + $oKPI->ComputeStats('FromRelationGraph', ''); return $oNewGraph; } @@ -1027,6 +1029,7 @@ class DisplayableGraph extends SimpleGraph */ public function InitFromGraphviz() { + $oKPI = new ExecutionKPI(); $sDot = $this->DumpAsXDot(); if (strpos($sDot, 'digraph') === false) { @@ -1054,6 +1057,7 @@ class DisplayableGraph extends SimpleGraph } } } + $oKPI->ComputeStats('InitFromGraphviz', ''); } public function GetBoundingBox() diff --git a/core/relationgraph.class.inc.php b/core/relationgraph.class.inc.php index 43b82f703..9cbc606b8 100644 --- a/core/relationgraph.class.inc.php +++ b/core/relationgraph.class.inc.php @@ -283,6 +283,8 @@ class RelationGraph extends SimpleGraph */ public function IsPartOfContext(DBObject $oObj, &$aRootCauses) { + $oKPI = new ExecutionKPI(); + $bRet = false; $sFinalClass = get_class($oObj); $aParentClasses = MetaModel::EnumParentClasses($sFinalClass, ENUM_PARENT_CLASSES_ALL); @@ -313,6 +315,7 @@ class RelationGraph extends SimpleGraph } } } + $oKPI->ComputeStats(__METHOD__, get_class($oObj)); return $bRet; } @@ -329,6 +332,7 @@ class RelationGraph extends SimpleGraph */ public function ComputeRelatedObjectsDown($sRelCode, $iMaxDepth, $bEnableRedundancy, $aUnreachableObjects = array()) { + $oKPI = new ExecutionKPI(); //echo "
Sources only...
\n".$this->DumpAsHtmlImage()."
\n"; // Build the graph out of the sources foreach ($this->aSourceNodes as $oSourceNode) @@ -336,8 +340,10 @@ class RelationGraph extends SimpleGraph $this->AddRelatedObjects($sRelCode, true, $oSourceNode, $iMaxDepth, $bEnableRedundancy); //echo "
After processing of {$oSourceNode->GetId()}
\n".$this->DumpAsHtmlImage()."
\n"; } + $oKPI->ComputeAndReport(__FUNCTION__.' - AddRelatedObjects'); // Mark the unreachable nodes + $oKPI = new ExecutionKPI(); foreach ($aUnreachableObjects as $oObj) { $sNodeId = RelationObjectNode::MakeId($oObj); @@ -347,14 +353,18 @@ class RelationGraph extends SimpleGraph $oNode->SetProperty('is_reached_allowed', false); } } + $oKPI->ComputeAndReport(__FUNCTION__.' - Mark unreachable nodes'); // Determine the reached nodes + $oKPI = new ExecutionKPI(); foreach ($this->aSourceNodes as $oSourceNode) { $oSourceNode->ReachDown('is_reached', true); //echo "
After reaching from {$oSourceNode->GetId()}
\n".$this->DumpAsHtmlImage()."
\n"; } + $oKPI->ComputeAndReport(__FUNCTION__.' - Determine reached nodes'); + $oKPI = new ExecutionKPI(); // Mark also the "context" nodes as reached and record the "root causes" for each node $oIterator = new RelationTypeIterator($this, 'Node'); foreach($oIterator as $oNode) @@ -367,9 +377,13 @@ class RelationGraph extends SimpleGraph $oNode->ReachDown('is_reached', true); } } + $oKPI->ComputeAndReport(__FUNCTION__.' - Mark context nodes as reached'); + + $oKPI = new ExecutionKPI(); if ( MetaModel::GetConfig()->Get('relations.complete_analysis')) { $this->ApplyUserRightsOnGraph(); } + $oKPI->ComputeAndReport(__FUNCTION__.' - Apply user rights on graph'); } /** @@ -384,6 +398,7 @@ class RelationGraph extends SimpleGraph */ public function ComputeRelatedObjectsUp($sRelCode, $iMaxDepth, $bEnableRedundancy) { + $oKPI = new ExecutionKPI(); //echo "
Sinks only...
\n".$this->DumpAsHtmlImage()."
\n"; // Build the graph out of the sinks foreach ($this->aSinkNodes as $oSinkNode) @@ -407,6 +422,7 @@ class RelationGraph extends SimpleGraph if ( MetaModel::GetConfig()->Get('relations.complete_analysis')) { $this->ApplyUserRightsOnGraph(); } + $oKPI->ComputeStats('GetRelatedObjects-Up', ''); } diff --git a/core/simplegraph.class.inc.php b/core/simplegraph.class.inc.php index 614ab031e..f00eb1d9f 100644 --- a/core/simplegraph.class.inc.php +++ b/core/simplegraph.class.inc.php @@ -517,8 +517,10 @@ EOF @fclose($rFile); $aOutput = array(); $CommandLine = "\"$sDotExecutable\" -v -Tpng < \"$sDotFilePath\" -o\"$sImageFilePath\" 2>&1"; - + + $oKPI = new ExecutionKPI(); exec($CommandLine, $aOutput, $iRetCode); + $oKPI->ComputeStats('Graphviz execution png', 'png'); if ($iRetCode != 0) { $sHtml = ''; @@ -573,8 +575,10 @@ EOF @fclose($rFile); $aOutput = array(); $CommandLine = "\"$sDotExecutable\" -v -Tdot < \"$sDotFilePath\" -o\"$sXdotFilePath\" 2>&1"; - + + $oKPI = new ExecutionKPI(); exec($CommandLine, $aOutput, $iRetCode); + $oKPI->ComputeStats('Graphviz execution dot', 'dot'); if ($iRetCode != 0) { $sHtml = ''; diff --git a/pages/ajax.render.php b/pages/ajax.render.php index ea5b95410..5b0eee99f 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -1862,6 +1862,7 @@ EOF } // Remove excluded classes from the graph + $oKPI = new ExecutionKPI(); if (count($aExcludedClasses) > 0) { $oIterator = new RelationTypeIterator($oRelGraph, 'Node'); foreach ($oIterator as $oNode) { @@ -1871,6 +1872,7 @@ EOF } } } + $oKPI->ComputeAndReport('Filtering nodes'); $oGraph = DisplayableGraph::FromRelationGraph($oRelGraph, $iGroupingThreshold, ($sDirection == 'down')); $oGraph->InitFromGraphviz();