From: Alexandre Emsenhuber Date: Thu, 2 Feb 2012 10:33:42 +0000 (+0000) Subject: Use $wgRequestTime in wfDebugTimer() to get the time since the start of the request... X-Git-Tag: 1.31.0-rc.0~24966 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=bb7b900db4e1ceb414834487b3f8f125698024d5;p=lhc%2Fweb%2Fwiklou.git Use $wgRequestTime in wfDebugTimer() to get the time since the start of the request instead the difference with the first call so that the time before that call is not ignored and for consistency with other time displays. --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 0e0bff23a0..b1bd3f2758 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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 "; } /**