r110558 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110557‎ | r110558 | r110559 >
Date:10:33, 2 February 2012
Author:ialex
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -911,20 +911,15 @@
912912 * @return string
913913 */
914914 function wfDebugTimer() {
915 - global $wgDebugTimestamps;
 915+ global $wgDebugTimestamps, $wgRequestTime;
 916+
916917 if ( !$wgDebugTimestamps ) {
917918 return '';
918919 }
919 - static $start = null;
920920
921 - if ( $start === null ) {
922 - $start = microtime( true );
923 - $prefix = "\n$start";
924 - } else {
925 - $prefix = sprintf( "%6.4f", microtime( true ) - $start );
926 - }
927 - $mem = sprintf( "%5.1fM", ( memory_get_usage( true ) / (1024*1024) ) );
928 - return "$prefix $mem " ;
 921+ $prefix = sprintf( "%6.4f", microtime( true ) - $wgRequestTime );
 922+ $mem = sprintf( "%5.1fM", ( memory_get_usage( true ) / ( 1024 * 1024 ) ) );
 923+ return "$prefix $mem ";
929924 }
930925
931926 /**

Status & tagging log