r81901 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81900‎ | r81901 | r81902 >
Date:16:54, 10 February 2011
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Move the overhead computation to another function.
Modified paths:
  • /trunk/phase3/includes/Profiler.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Profiler.php
@@ -263,12 +263,7 @@
264264
265265 # Estimate profiling overhead
266266 $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 );
273268
274269 # First, subtract the overhead!
275270 $overheadTotal = $overheadMemory = $overheadInternal = array();
@@ -348,6 +343,18 @@
349344 }
350345
351346 /**
 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+ /**
352359 * Counts the number of profiled function calls sitting under
353360 * the given point in the call graph. Not the most efficient algo.
354361 *

Comments

#Comment by Hashar (talk | contribs)   12:24, 22 February 2011

Lovely dummy calls! We should make more of them, specially in the parser. They make code easier to read.

Status & tagging log