2010-06-05 15:24:37 +03:00
|
|
|
|
<?php
|
|
|
|
|
/*-------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
* LiveStreet Engine Social Networking
|
|
|
|
|
* Copyright © 2008 Mzhelskiy Maxim
|
|
|
|
|
*
|
|
|
|
|
*--------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
* Official site: www.livestreet.ru
|
|
|
|
|
* Contact e-mail: rus.engine@gmail.com
|
|
|
|
|
*
|
|
|
|
|
* GNU General Public License, version 2:
|
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
|
*
|
|
|
|
|
---------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Регистрация хука для вывода статистики производительности
|
|
|
|
|
*
|
2012-05-04 13:45:34 +03:00
|
|
|
|
* @package hooks
|
|
|
|
|
* @since 1.0
|
2010-06-05 15:24:37 +03:00
|
|
|
|
*/
|
|
|
|
|
class HookStatisticsPerformance extends Hook {
|
2012-05-04 13:45:34 +03:00
|
|
|
|
/**
|
|
|
|
|
* Регистрируем хуки
|
|
|
|
|
*/
|
2010-06-05 15:24:37 +03:00
|
|
|
|
public function RegisterHook() {
|
|
|
|
|
$this->AddHook('template_body_end','Statistics',__CLASS__,-1000);
|
|
|
|
|
}
|
2012-05-04 13:45:34 +03:00
|
|
|
|
/**
|
|
|
|
|
* Обработка хука перед закрывающим тегом body
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2010-06-05 15:24:37 +03:00
|
|
|
|
public function Statistics() {
|
|
|
|
|
$oEngine=Engine::getInstance();
|
2012-05-04 13:45:34 +03:00
|
|
|
|
/**
|
|
|
|
|
* Подсчитываем время выполнения
|
|
|
|
|
*/
|
2010-06-05 15:24:37 +03:00
|
|
|
|
$iTimeInit=$oEngine->GetTimeInit();
|
|
|
|
|
$iTimeFull=round(microtime(true)-$iTimeInit,3);
|
|
|
|
|
$this->Viewer_Assign('iTimeFullPerformance',$iTimeFull);
|
2012-05-04 13:45:34 +03:00
|
|
|
|
/**
|
|
|
|
|
* Получаем статистику по кешу и БД
|
|
|
|
|
*/
|
2010-06-05 15:24:37 +03:00
|
|
|
|
$aStats=$oEngine->getStats();
|
|
|
|
|
$aStats['cache']['time']=round($aStats['cache']['time'],5);
|
|
|
|
|
$this->Viewer_Assign('aStatsPerformance',$aStats);
|
|
|
|
|
$this->Viewer_Assign('bIsShowStatsPerformance',Router::GetIsShowStats());
|
2012-05-04 13:45:34 +03:00
|
|
|
|
/**
|
|
|
|
|
* В ответ рендерим шаблон статистики
|
|
|
|
|
*/
|
2013-06-30 06:02:51 +03:00
|
|
|
|
return $this->Viewer_Fetch('actions/ActionAdmin/statistics_performance.tpl');
|
2010-06-05 15:24:37 +03:00
|
|
|
|
}
|
2014-05-28 08:37:30 +03:00
|
|
|
|
}
|