]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - includes/Profiler.php
MediaWiki 1.16.0
[autoinstalls/mediawiki.git] / includes / Profiler.php
index 80a6a68a5557a028bef120706d03795ceeb431a5..817b71ab2cf365351cbde7fb7ba14ebb4c7b347f 100644 (file)
@@ -12,7 +12,7 @@ $wgProfiling = true;
 
 /**
  * Begin profiling of a function
- * @param $functioname name of the function we will profile
+ * @param $functionname name of the function we will profile
  */
 function wfProfileIn( $functionname ) {
        global $wgProfiler;
@@ -21,7 +21,7 @@ function wfProfileIn( $functionname ) {
 
 /**
  * Stop profiling of a function
- * @param $functioname name of the function we have profiled
+ * @param $functionname name of the function we have profiled
  */
 function wfProfileOut( $functionname = 'missing' ) {
        global $wgProfiler;
@@ -31,8 +31,8 @@ function wfProfileOut( $functionname = 'missing' ) {
 /**
  * Returns a profiling output to be stored in debug file
  *
- * @param float $start
- * @param float $elapsed time elapsed since the beginning of the request
+ * @param $start Float
+ * @param $elapsed Float: time elapsed since the beginning of the request
  */
 function wfGetProfilingOutput( $start, $elapsed ) {
        global $wgProfiler;
@@ -128,6 +128,12 @@ class Profiler {
         * called by wfProfileClose()
         */
        function close() {
+               global $wgProfiling;
+
+               # Avoid infinite loop
+               if( !$wgProfiling )
+                       return;
+
                while( count( $this->mWorkStack ) ){
                        $this->profileOut( 'close' );
                }
@@ -253,6 +259,7 @@ class Profiler {
                wfProfileOut( '-overhead-total' );
 
                # First, subtract the overhead!
+               $overheadTotal = $overheadMemory = $overheadInternal = array();
                foreach( $this->mStack as $entry ){
                        $fname = $entry[0];
                        $start = $entry[2];