summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-01-29 09:36:06 +0000
committeralecpl <alec@alec.pl>2010-01-29 09:36:06 +0000
commit2b35c5d8f6526c86d356913f151af7e6df3c2976 (patch)
tree33b1d58fe03c42c9c717d87ea26648fd527948b3
parent3e63802071bda6e7e8766542e3cb463bd43f23d2 (diff)
- performance stats logging in devel_mode
-rwxr-xr-xprogram/include/iniset.php1
-rw-r--r--program/include/rcmail.php11
2 files changed, 12 insertions, 0 deletions
diff --git a/program/include/iniset.php b/program/include/iniset.php
index 99f2f908a..94d49d8aa 100755
--- a/program/include/iniset.php
+++ b/program/include/iniset.php
@@ -25,6 +25,7 @@
define('RCMAIL_VERSION', '0.3-trunk');
define('RCMAIL_CHARSET', 'UTF-8');
define('JS_OBJECT_NAME', 'rcmail');
+define('RCMAIL_START', microtime(true));
if (!defined('INSTALL_PATH')) {
define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index e3c826111..3d26065d5 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -853,6 +853,17 @@ class rcmail
// before closing the database connection, write session data
if ($_SERVER['REMOTE_ADDR'])
session_write_close();
+
+ // write performance stats to logs/console
+ if ($this->config->get('devel_mode')) {
+ if (function_exists('memory_get_usage'))
+ $mem = show_bytes(memory_get_usage());
+ if (function_exists('memory_get_peak_usage'))
+ $mem .= '/'.show_bytes(memory_get_peak_usage());
+
+ $log = $this->task . ($this->action ? '/'.$this->action : '') . ($mem ? " [$mem]" : '');
+ rcube_print_time(RCMAIL_START, $log);
+ }
}