예제 #1
0
 /**
  * End the timer for this step
  *
  * Call this after the code that is being profiled by this step has completed executing
  *
  * @param string $profilerKey this is for internal use only! don't ever pass anything! {@link profiler::$profilerKey}
  * 
  * @return bool|ProfilerNode returns parent node, or null if there is no parent
  */
 public function end($profilerKey = null)
 {
     if (!$profilerKey || $profilerKey != $this->profilerKey) {
         profiler::end($this->name);
         return $this->parentNode;
     }
     if (null == $this->ended) {
         $this->ended = microtime(true);
         $this->totalDuration = $this->ended - $this->started;
         $this->selfDuration = $this->totalDuration - $this->childDuration;
         if ($this->parentNode) {
             $this->parentNode->increaseChildDuration($this->totalDuration);
             profiler::addDuration($this->selfDuration);
         }
     }
     return $this->parentNode;
 }