framework/logging/CProfileLogRoute.php
protected function displaySummary($logs)
	{
		$stack=array();
		$results=array();
		foreach($logs as $log)
		{
			if($log[1]!==CLogger::LEVEL_PROFILE)
				continue;
			$message=$log[0];
			if(!strncasecmp($message,'begin:',6))
			{
				$log[0]=substr($message,6);
				$stack[]=$log;
			}
			elseif(!strncasecmp($message,'end:',4))
			{
				$token=substr($message,4);
				if(($last=array_pop($stack))!==null && $last[0]===$token)
				{
					$delta=$log[3]-$last[3];
					if(!$this->groupByToken)
						$token=$log[2];
					if(isset($results[$token]))
						$results[$token]=$this->aggregateResult($results[$token],$delta);
					else
						$results[$token]=array($token,1,$delta,$delta,$delta);
				}
				else
					throw new CException(Yii::t('yii','CProfileLogRoute found a mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.',
						array('{token}'=>$token)));
			}
		}

		$now=microtime(true);
		while(($last=array_pop($stack))!==null)
		{
			$delta=$now-$last[3];
			$token=$this->groupByToken ? $last[0] : $last[2];
			if(isset($results[$token]))
				$results[$token]=$this->aggregateResult($results[$token],$delta);
			else
				$results[$token]=array($token,1,$delta,$delta,$delta);
		}

		$entries=array_values($results);
		usort($entries, array($this, 'resultEntryCompare'));

		$this->render('profile-summary',$entries);
	}
protected function displaySummary($logs)
	{
		$stack=array();
		$results=array();
		foreach($logs as $log)
		{
			if($log[1]!==CLogger::LEVEL_PROFILE)
				continue;
			$message=$log[0];
			if(!strncasecmp($message,'begin:',6))
			{
				$log[0]=substr($message,6);
				$stack[]=$log;
			}
			elseif(!strncasecmp($message,'end:',4))
			{
				$token=substr($message,4);
				if(($last=array_pop($stack))!==null && $last[0]===$token)
				{
					$delta=$log[3]-$last[3];
					if(!$this->groupByToken)
						$token=$log[2];
					if(isset($results[$token]))
						$results[$token]=$this->aggregateResult($results[$token],$delta);
					else
						$results[$token]=array($token,1,$delta,$delta,$delta);
				}
				else
					throw new CException(Yii::t('yii','CProfileLogRoute found a mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.',
						array('{token}'=>$token)));
			}
		}

		$now=microtime(true);
		while(($last=array_pop($stack))!==null)
		{
			$delta=$now-$last[3];
			$token=$this->groupByToken ? $last[0] : $last[2];
			if(isset($results[$token]))
				$results[$token]=$this->aggregateResult($results[$token],$delta);
			else
				$results[$token]=array($token,1,$delta,$delta,$delta);
		}

		$entries=array_values($results);
		usort($entries, array($this, 'resultEntryCompare'));

		$this->render('profile-summary',$entries);
	}
protected function displaySummary ( $ logs ) { $ stack = array ( ) ; $ results = array ( ) ; foreach ( $ logs as $ log ) { if ( $ log [ 1 ] !== CLogger :: LEVEL_PROFILE ) continue ; $ message = $ log [ 0 ] ; if ( ! strncasecmp ( $ message , 'begin:' , 6 ) ) { $ log [ 0 ] = substr ( $ message , 6 ) ; $ stack [ ] = $ log ; } elseif ( ! strncasecmp ( $ message , 'end:' , 4 ) ) { $ token = substr ( $ message , 4 ) ; if ( ( $ last = array_pop ( $ stack ) ) !== null && $ last [ 0 ] === $ token ) { $ delta = $ log [ 3 ] - $ last [ 3 ] ; if ( ! $ this -> groupByToken ) $ token = $ log [ 2 ] ; if ( isset ( $ results [ $ token ] ) ) $ results [ $ token ] = $ this -> aggregateResult ( $ results [ $ token ] , $ delta ) ; else $ results [ $ token ] = array ( $ token , 1 , $ delta , $ delta , $ delta ) ; } else throw new CException ( Yii :: t ( 'yii' , 'CProfileLogRoute found a mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.' , array ( '{token}' => $ token ) ) ) ; } } $ now = microtime ( true ) ; while ( ( $ last = array_pop ( $ stack ) ) !== null ) { $ delta = $ now - $ last [ 3 ] ; $ token = $ this -> groupByToken ? $ last [ 0 ] : $ last [ 2 ] ; if ( isset ( $ results [ $ token ] ) ) $ results [ $ token ] = $ this -> aggregateResult ( $ results [ $ token ] , $ delta ) ; else $ results [ $ token ] = array ( $ token , 1 , $ delta , $ delta , $ delta ) ; } $ entries = array_values ( $ results ) ; usort ( $ entries , array ( $ this , 'resultEntryCompare' ) ) ; $ this -> render ( 'profile-summary' , $ entries ) ; }
Displays the summary report of the profiling result.
@param array $logs list of logs
@throws CException if Yii::beginProfile() and Yii::endProfile() are not matching
Displays the summary report of the profiling result .