From bb7b900db4e1ceb414834487b3f8f125698024d5 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 2 Feb 2012 10:33:42 +0000 Subject: [PATCH] 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. --- includes/GlobalFunctions.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) 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 "; } /** -- 2.20.1