Module: nagvis Branch: master Commit: 0fc1bffc328ef7da33959b4809b4b84c37975e42 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=0fc1bffc328ef7da33959b4809b4b84c37975e42
Author: Lars Michelsen <[email protected]> Date: Tue May 4 23:38:37 2010 +0200 Removed usage of getters at high used code to reduce cpu calls --- share/server/core/classes/CoreBackendMgmt.php | 6 +----- share/server/core/classes/objects/NagVisObject.php | 12 ++++++------ .../core/classes/objects/NagVisStatefulObject.php | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/share/server/core/classes/CoreBackendMgmt.php b/share/server/core/classes/CoreBackendMgmt.php index 0ebee19..c7e130e 100644 --- a/share/server/core/classes/CoreBackendMgmt.php +++ b/share/server/core/classes/CoreBackendMgmt.php @@ -64,15 +64,11 @@ class CoreBackendMgmt { * * Add a backend query to the queue * - * @param String Query ID to add to the queue + * @param Array Queries to be added to the queue * @param Object Map object to fetch the informations for * @author Lars Michelsen <[email protected]> */ public function queue($query, $OBJ) { - if(!is_array($query)) { - $query = Array($query => true); - } - $backendId = $OBJ->getBackendId(); if(!isset($this->aQueue[$backendId])) $this->aQueue[$backendId] = Array(); diff --git a/share/server/core/classes/objects/NagVisObject.php b/share/server/core/classes/objects/NagVisObject.php index 90acb73..64b5527 100644 --- a/share/server/core/classes/objects/NagVisObject.php +++ b/share/server/core/classes/objects/NagVisObject.php @@ -554,8 +554,8 @@ class NagVisObject { * @author Lars Michelsen <[email protected]> */ private static function sortObjectsByState($OBJ1, $OBJ2) { - $state1 = $OBJ1->getSummaryState(); - $state2 = $OBJ2->getSummaryState(); + $state1 = $OBJ1->summary_state; + $state2 = $OBJ2->summary_state; // Quit when nothing to compare if($state1 == '' || $state2 == '') { @@ -567,16 +567,16 @@ class NagVisObject { // Handle normal/ack/downtime states $stubState1 = 'normal'; - if($OBJ1->getSummaryAcknowledgement() == 1 && isset($stateWeight[$state1]['ack'])) { + if($OBJ1->summary_problem_has_been_acknowledged == 1 && isset($stateWeight[$state1]['ack'])) { $stubState1 = 'ack'; - } elseif($OBJ1->getSummaryInDowntime() == 1 && isset($stateWeight[$state1]['downtime'])) { + } elseif($OBJ1->summary_in_downtime == 1 && isset($stateWeight[$state1]['downtime'])) { $stubState1 = 'downtime'; } $stubState2 = 'normal'; - if($OBJ2->getSummaryAcknowledgement() == 1 && isset($stateWeight[$state2]['ack'])) { + if($OBJ2->summary_problem_has_been_acknowledged == 1 && isset($stateWeight[$state2]['ack'])) { $stubState2 = 'ack'; - } elseif($OBJ2->getSummaryInDowntime() == 1 && isset($stateWeight[$state2]['downtime'])) { + } elseif($OBJ2->summary_in_downtime == 1 && isset($stateWeight[$state2]['downtime'])) { $stubState2 = 'downtime'; } diff --git a/share/server/core/classes/objects/NagVisStatefulObject.php b/share/server/core/classes/objects/NagVisStatefulObject.php index a42e637..535f75d 100644 --- a/share/server/core/classes/objects/NagVisStatefulObject.php +++ b/share/server/core/classes/objects/NagVisStatefulObject.php @@ -663,7 +663,7 @@ class NagVisStatefulObject extends NagVisObject { public function getChildFetchingStateFilters() { $stateCounts = Array(); $stateWeight = $this->CORE->getMainCfg()->getStateWeight(); - if(is_array($this->aStateCounts)) { + if($this->aStateCounts !== null) { foreach($this->aStateCounts AS $sState => $aSubstates) { if(isset($stateWeight[$sState]) && isset($stateWeight[$sState]['normal']) @@ -756,9 +756,9 @@ class NagVisStatefulObject extends NagVisObject { if(isset($stateWeight[$this->summary_state])) { $sCurrSubState = 'normal'; - if($this->getSummaryAcknowledgement() == 1 && isset($stateWeight[$this->summary_state]['ack'])) { + if($this->summary_problem_has_been_acknowledged == 1 && isset($stateWeight[$this->summary_state]['ack'])) { $sCurrSubState = 'ack'; - } elseif($this->getSummaryInDowntime() == 1 && isset($stateWeight[$this->summary_state]['downtime'])) { + } elseif($this->summary_in_downtime == 1 && isset($stateWeight[$this->summary_state]['downtime'])) { $sCurrSubState = 'downtime'; } @@ -771,7 +771,7 @@ class NagVisStatefulObject extends NagVisObject { // Loop all major states $iSumCount = 0; - if(is_array($this->aStateCounts)) { + if($this->aStateCounts !== null) { foreach($this->aStateCounts AS $sState => $aSubstates) { // Loop all substates (normal,ack,downtime,...) foreach($aSubstates AS $sSubState => $iCount) { @@ -852,14 +852,14 @@ class NagVisStatefulObject extends NagVisObject { * @author Lars Michelsen <[email protected]> */ protected function wrapChildState($OBJ) { - $sSummaryState = $this->getSummaryState(); - $sObjSummaryState = $OBJ->getSummaryState(); + $sSummaryState = $this->summary_state; + $sObjSummaryState = $OBJ->summary_state; $stateWeight = $this->CORE->getMainCfg()->getStateWeight(); if(isset($stateWeight[$sObjSummaryState])) { - $objAck = $OBJ->getSummaryAcknowledgement(); - $objDowntime = $OBJ->getSummaryInDowntime(); + $objAck = $OBJ->summary_problem_has_been_acknowledged; + $objDowntime = $OBJ->summary_in_downtime; if($sSummaryState != '') { /* When the state of the current child is not as good as the current @@ -868,9 +868,9 @@ class NagVisStatefulObject extends NagVisObject { // Gather the current summary state type $sType = 'normal'; - if($this->getSummaryAcknowledgement() == 1 && isset($stateWeight[$sSummaryState]['ack'])) { + if($this->summary_problem_has_been_acknowledged == 1 && isset($stateWeight[$sSummaryState]['ack'])) { $sType = 'ack'; - } elseif($this->getSummaryInDowntime() == 1 && isset($stateWeight[$sSummaryState]['downtime'])) { + } elseif($this->summary_in_downtime == 1 && isset($stateWeight[$sSummaryState]['downtime'])) { $sType = 'downtime'; } ------------------------------------------------------------------------------ _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
