]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add a comment to show runtime at the end of a page
authorEvan Prodromou <evan@status.net>
Mon, 31 Jan 2011 18:59:38 +0000 (13:59 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 31 Jan 2011 18:59:38 +0000 (13:59 -0500)
index.php
lib/action.php

index 6f011e7e5bba37bcf7a0dce17765a75625c9ca6d..37c157b01fcc68a71ba100fe0032b4d62353ed64 100644 (file)
--- 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
index 0e5d7ae361c0539569e8052c37bc5e73f31da952..24d752719606b5b67b7ab610431d87328e798703 100644 (file)
@@ -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("<!-- ${diff}ms -->");
+        }
+
+        return parent::endHTML();
+    }
+
     /**
      * Show head, a template method.
      *