Меня кроме собственно запросов еще интересует общее время генерации страницы, время выполнения каждого запроса и в каком файле данный запрос генерируется. Рассказываю, как обычно поступаю я.
1. В /index.php перед строкой
require_once( 'includes/joomla.php' );
добавляем (xxx.xx.xx.xxx — это мой IP)
if($_SERVER['REMOTE_ADDR']=='xxx.xx.xx.xxx')
{
$mosConfig_caching = '0';
$mosConfig_debug = '1';
set_time_limit(0);
}
а после нее добавляем
$prof = new mosProfiler();
2. В конце /index.php после блока
echo $database->_ticker . ' queries executed';
echo '<pre>';
foreach ($database->_log as $k=>$sql) {
echo $k+1 . "\n" . $sql . '<hr />';
}
echo '</pre>';
добавляем
echo 'The page is generated in '.strip_tags($prof->mark('')).' sec.';
3. В файле /includes/database.php в функции query() меняем блок
if ($this->_debug) {
$this->_ticker++;
$this->_log[] = $this->_sql;
}
$this->_errorNum = 0;
$this->_errorMsg = '';
$this->_cursor = mysql_query( $this->_sql, $this->_resource );
на
if ($this->_debug) {
$this->_ticker++;
list($usec,$sec)=explode(" ",microtime());
$timer1=(float)$usec+(float)$sec;
}
$this->_errorNum = 0;
$this->_errorMsg = '';
$this->_cursor = mysql_query( $this->_sql, $this->_resource );
if ($this->_debug) {
global $prof;
list($usec,$sec)=explode(" ",microtime());
$timer2=(float)$usec+(float)$sec;
$backs=debug_backtrace();
$count=count($backs);
$str='';
for($i=0;$i<$count;$i++)
$str.='<-'.$backs[$i]['file'].':'.$backs[$i]['line'];
$this->_log[] = ($timer1-$prof->start).' sec: ('.($timer2-$timer1).' sec) '.
$this->_sql.' <small>['.$str.']</small>';
}