Use $wgRequestTime in wfDebugTimer() to get the time since the start of the request...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 2 Feb 2012 10:33:42 +0000 (10:33 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 2 Feb 2012 10:33:42 +0000 (10:33 +0000)
includes/GlobalFunctions.php

index 0e0bff2..b1bd3f2 100644 (file)
@@ -911,20 +911,15 @@ function wfIsDebugRawPage() {
  * @return string
  */
 function wfDebugTimer() {
-       global $wgDebugTimestamps;
+       global $wgDebugTimestamps, $wgRequestTime;
+
        if ( !$wgDebugTimestamps ) {
                return '';
        }
-       static $start = null;
 
-       if ( $start === null ) {
-               $start = microtime( true );
-               $prefix = "\n$start";
-       } else {
-               $prefix = sprintf( "%6.4f", microtime( true ) - $start );
-       }
-       $mem = sprintf( "%5.1fM", ( memory_get_usage( true ) / (1024*1024) ) );
-       return "$prefix $mem  " ;
+       $prefix = sprintf( "%6.4f", microtime( true ) - $wgRequestTime );
+       $mem = sprintf( "%5.1fM", ( memory_get_usage( true ) / ( 1024 * 1024 ) ) );
+       return "$prefix $mem  ";
 }
 
 /**