summaryrefslogtreecommitdiff
path: root/public_html
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-06-27 18:02:51 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-06-27 18:02:51 (GMT)
commit9cef87e8dea14a3758bff0464e31482616568cae (patch)
treec09a1bbb34cd77637740637fcd75c1b079c2fa2c /public_html
parent38e15b20e48359f3aedbc739f93b5856175e0771 (diff)
downloadiRony-9cef87e8dea14a3758bff0464e31482616568cae.tar.gz
Log execution time and memory usage in debug mode
Diffstat (limited to 'public_html')
-rw-r--r--public_html/index.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/public_html/index.php b/public_html/index.php
index f9c86b4..fcad3b8 100644
--- a/public_html/index.php
+++ b/public_html/index.php
@@ -27,6 +27,7 @@
// define some environment variables used thoughout the app and libraries
define('KOLAB_DAV_ROOT', realpath('../'));
define('KOLAB_DAV_VERSION', '0.1.0');
+define('KOLAB_DAV_START', microtime(true));
define('RCUBE_INSTALL_PATH', KOLAB_DAV_ROOT . '/');
define('RCUBE_CONFIG_DIR', KOLAB_DAV_ROOT . '/config/');
@@ -148,5 +149,17 @@ $server->exec();
if ($debug) {
$rcube->write_log('davdebug', "RESPONSE:\n" . ob_get_contents());
ob_end_flush();
-}
+ if (function_exists('memory_get_peak_usage'))
+ $mem = memory_get_peak_usage();
+ else if (function_exists('memory_get_usage'))
+ $mem = memory_get_usage();
+
+ $log = trim($server->getRequestUri() . ($mem ? sprintf(' [%.1f MB]', $mem/1024/1024) : ''));
+ if (defined('KOLAB_DAV_START')) {
+ rcube::print_timer(KOLAB_DAV_START, $log);
+ }
+ else {
+ rcube::console($log);
+ }
+}