Index: trunk/phase3/includes/Profiler.php |
— | — | @@ -263,12 +263,7 @@ |
264 | 264 | |
265 | 265 | # Estimate profiling overhead |
266 | 266 | $profileCount = count($this->mStack); |
267 | | - wfProfileIn( '-overhead-total' ); |
268 | | - for( $i = 0; $i < $profileCount; $i ++ ){ |
269 | | - wfProfileIn( '-overhead-internal' ); |
270 | | - wfProfileOut( '-overhead-internal' ); |
271 | | - } |
272 | | - wfProfileOut( '-overhead-total' ); |
| 267 | + self::calculateOverhead( $profileCount ); |
273 | 268 | |
274 | 269 | # First, subtract the overhead! |
275 | 270 | $overheadTotal = $overheadMemory = $overheadInternal = array(); |
— | — | @@ -348,6 +343,18 @@ |
349 | 344 | } |
350 | 345 | |
351 | 346 | /** |
| 347 | + * Dummy calls to wfProfileIn/wfProfileOut to calculate its overhead |
| 348 | + */ |
| 349 | + protected static function calculateOverhead( $profileCount ) { |
| 350 | + wfProfileIn( '-overhead-total' ); |
| 351 | + for( $i = 0; $i < $profileCount; $i++ ){ |
| 352 | + wfProfileIn( '-overhead-internal' ); |
| 353 | + wfProfileOut( '-overhead-internal' ); |
| 354 | + } |
| 355 | + wfProfileOut( '-overhead-total' ); |
| 356 | + } |
| 357 | + |
| 358 | + /** |
352 | 359 | * Counts the number of profiled function calls sitting under |
353 | 360 | * the given point in the call graph. Not the most efficient algo. |
354 | 361 | * |