From: Matthias Schmidt Date: Sat, 4 Oct 2014 09:54:46 +0000 (+0200) Subject: Add benchmark data to AJAXProxyAction response X-Git-Tag: 2.1.0_Alpha_1~280 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=26385922b381f9c464e90fb69fc4af8c214f7c49;p=GitHub%2FWoltLab%2FWCF.git Add benchmark data to AJAXProxyAction response --- diff --git a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php index 24399108de..cd34bd1201 100644 --- a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php +++ b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php @@ -2,6 +2,7 @@ namespace wcf\action; use wcf\data\IStorableObject; use wcf\system\exception\SystemException; +use wcf\system\WCF; use wcf\util\ArrayUtil; use wcf\util\ClassUtil; use wcf\util\StringUtil; @@ -97,4 +98,26 @@ class AJAXProxyAction extends AJAXInvokeAction { } return $response; } + + /** + * @see \wcf\action\AJAXInvokeAction::sendResponse() + */ + protected function sendResponse() { + // add benchmark and debug data + if (ENABLE_BENCHMARK) { + $this->response['benchmark'] = array( + 'executionTime' => WCF::getBenchmark()->getExecutionTime().'s', + 'memoryUsage' => WCF::getBenchmark()->getMemoryUsage(), + 'phpExecution' => StringUtil::formatNumeric((WCF::getBenchmark()->getExecutionTime() - WCF::getBenchmark()->getQueryExecutionTime()) / WCF::getBenchmark()->getExecutionTime() * 100).'%', + 'sqlExecution' => StringUtil::formatNumeric(WCF::getBenchmark()->getQueryExecutionTime() / WCF::getBenchmark()->getExecutionTime() * 100).'%', + 'sqlQueries' => WCF::getBenchmark()->getQueryCount() + ); + + if (ENABLE_DEBUG_MODE) { + $this->response['benchmark']['items'] = WCF::getBenchmark()->getItems(); + } + } + + parent::sendResponse(); + } }