Committing live hack: don't adjust for times where elapsed is 0
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 17 Aug 2005 20:07:07 +0000 (20:07 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 17 Aug 2005 20:07:07 +0000 (20:07 +0000)
includes/Profiling.php

index 1fb1ae0..634735c 100755 (executable)
@@ -245,10 +245,12 @@ class Profiler {
                        $subcalls = $this->calltreeCount($this->mStack, $index);
 
                        if (!preg_match('/^-overhead/', $fname)) {
-                               # Adjust for profiling overhead
-                               $elapsed -= $overheadInternal;
-                               $elapsed -= ($subcalls * $overheadTotal);
-                               $memory -= ($subcalls * $overheadMemory);
+                               # Adjust for profiling overhead (except special values with elapsed=0
+                               if ( $elapsed ) {
+                                       $elapsed -= $overheadInternal;
+                                       $elapsed -= ($subcalls * $overheadTotal);
+                                       $memory -= ($subcalls * $overheadMemory);
+                               }
                        }
 
                        if (!array_key_exists($fname, $this->mCollated)) {