aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2011-12-23 22:04:24 +0100
committerKevin Chabowski <kevin@kch42.de>2011-12-23 22:04:24 +0100
commit64d30a2bacc59f8a2c38c4998071e7bf9c942c2e (patch)
treec1bd2800d8319944e2250c20546ba774df6b3305 /ratatoeskr
parent0a0711c59743a2410fe672a4cc84cd2656ddada6 (diff)
downloadratatoeskr-cms-64d30a2bacc59f8a2c38c4998071e7bf9c942c2e.tar.gz
ratatoeskr-cms-64d30a2bacc59f8a2c38c4998071e7bf9c942c2e.tar.bz2
ratatoeskr-cms-64d30a2bacc59f8a2c38c4998071e7bf9c942c2e.zip
Print out some performance information.
Queries fired and execution time.
Diffstat (limited to 'ratatoeskr')
-rw-r--r--ratatoeskr/main.php9
-rw-r--r--ratatoeskr/sys/db.php4
2 files changed, 13 insertions, 0 deletions
diff --git a/ratatoeskr/main.php b/ratatoeskr/main.php
index 2a31177..9d963ac 100644
--- a/ratatoeskr/main.php
+++ b/ratatoeskr/main.php
@@ -23,6 +23,10 @@ $plugin_objs = array();
function ratatoeskr()
{
global $backend_subactions, $ste, $url_handlers, $ratatoeskr_settings, $plugin_objs;
+ global $queries_fired;
+
+ $ts_start = microtime(True);
+
session_start();
if(!CONFIG_FILLED_OUT)
return setup();
@@ -67,6 +71,11 @@ function ratatoeskr()
$ste->vars["rel_path_to_root"] = $rel_path_to_root;
url_process($urlpath, $url_handlers, $data);
+ echo "<!--
+Queries: $queries_fired
+Time: " . (microtime(True) - $ts_start) . "
+Peak Memory: " . memory_get_peak_usage() / 1024 . "kiB
+-->";
}
?>
diff --git a/ratatoeskr/sys/db.php b/ratatoeskr/sys/db.php
index e5caddc..cbf2100 100644
--- a/ratatoeskr/sys/db.php
+++ b/ratatoeskr/sys/db.php
@@ -76,6 +76,8 @@ function qdb_fmt()
return qdb_vfmt(func_get_args());
}
+$queries_fired = 0;
+
/*
* Function: qdb
* Query Database.
@@ -89,10 +91,12 @@ function qdb_fmt()
*/
function qdb()
{
+ global $queries_fired;
$query = qdb_vfmt(func_get_args());
$rv = mysql_query($query);
if($rv === false)
throw new MySQLException(mysql_errno() . ': ' . mysql_error() . (__DEBUG__ ? ("[[FULL QUERY: " . $query . "]]") : "" ));
+ $queries_fired++;
return $rv;
}