Committed a polished local hack I've been using.
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 19 Sep 2011 11:05:10 +0000 (11:05 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 19 Sep 2011 11:05:10 +0000 (11:05 +0000)
At times useful to see if something is hogging much memory.
Didn't really want to add a new global for this.

includes/DefaultSettings.php
includes/GlobalFunctions.php

index 27c88f1..b9a6776 100644 (file)
@@ -4006,6 +4006,7 @@ $wgShowDebug            = false;
 
 /**
  * Prefix debug messages with relative timestamp. Very-poor man's profiler.
+ * Since 1.19 also includes memory usage.
  */
 $wgDebugTimestamps = false;
 
index 98331da..4a722b5 100644 (file)
@@ -756,8 +756,8 @@ function wfDebugTimer() {
        } else {
                $prefix = sprintf( "%6.4f", microtime( true ) - $start );
        }
-
-       return $prefix . '  ';
+       $mem = sprintf( "%5.1fM", ( memory_get_usage( true ) / (1024*1024) ) );
+       return "$prefix $mem  " ;
 }
 
 /**