X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/mediawiki.git/blobdiff_plain/8989532d3de45b196373107c7a812a68ac0ff2d9..d75ce11339b35963b5f8c3d53190819c1c025716:/includes/Profiler.php diff --git a/includes/Profiler.php b/includes/Profiler.php index 80a6a68a..817b71ab 100644 --- a/includes/Profiler.php +++ b/includes/Profiler.php @@ -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];