summaryrefslogtreecommitdiff
path: root/includes/Profiler.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Profiler.php')
-rw-r--r--includes/Profiler.php15
1 files changed, 11 insertions, 4 deletions
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];