Fix 2714 : backlink from special:whatlinkshere was hard set as 'existing'
[lhc/web/wiklou.git] / includes / Profiling.php
index 316f264..6dc007c 100755 (executable)
@@ -44,14 +44,19 @@ if (!function_exists('memory_get_usage')) {
 class Profiler {
        var $mStack = array (), $mWorkStack = array (), $mCollated = array ();
        var $mCalls = array (), $mTotals = array ();
-       /*
+       
        function Profiler()
        {
-               $this->mProfileStack = array();
-               $this->mWorkStack = array();
-               $this->mCollated = array();
+               // Push an entry for the pre-profile setup time onto the stack
+               global $wgRequestTime;
+               if ( !empty( $wgRequestTime ) ) {
+                       $this->mWorkStack[] = array( '-total', 0, $wgRequestTime, 0 );
+                       $this->mStack[] = array( '-setup', 1, $wgRequestTime, 0, microtime(), 0 );
+               } else {
+                       $this->profileIn( '-total' );
+               }
+                       
        }
-       */
 
        function profileIn($functionname) {
                global $wgDebugFunctionEntry;
@@ -65,7 +70,7 @@ class Profiler {
                $memory = memory_get_usage();
                $time = $this->getTime();
 
-               global $wgDebugProfiling, $wgDebugFunctionEntry;
+               global $wgDebugFunctionEntry;
 
                if ($wgDebugFunctionEntry && function_exists('wfDebug')) {
                        wfDebug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n");
@@ -349,5 +354,5 @@ class Profiler {
 }
 
 $wgProfiler = new Profiler();
-$wgProfiler->profileIn('-total');
+
 ?>