From ca4bf541310eb36fae5a69697bba76a2211218f4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 31 Jan 2011 13:59:38 -0500 Subject: [PATCH] add a comment to show runtime at the end of a page --- index.php | 2 ++ lib/action.php | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/index.php b/index.php index 6f011e7e5b..37c157b01f 100644 --- a/index.php +++ b/index.php @@ -37,6 +37,8 @@ * @license GNU Affero General Public License http://www.gnu.org/licenses/ */ +$_startTime = microtime(true); + define('INSTALLDIR', dirname(__FILE__)); define('STATUSNET', true); define('LACONICA', true); // compatibility diff --git a/lib/action.php b/lib/action.php index 0e5d7ae361..24d7527196 100644 --- a/lib/action.php +++ b/lib/action.php @@ -111,6 +111,19 @@ class Action extends HTMLOutputter // lawsuit } } + function endHTML() + { + global $_startTime; + + if (isset($_startTime)) { + $endTime = microtime(true); + $diff = round(($endTime - $_startTime) * 1000); + $this->raw(""); + } + + return parent::endHTML(); + } + /** * Show head, a template method. *