MediaWiki r10599 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r10598‎ | r10599 (on ViewVC)‎ | r10600 >
Date:20:08, 17 August 2005
Author:vibber
Status:old
Tags:
Comment:
Committing live hacks: profiling
Modified paths:

Diff [purge]

Index: branches/REL1_5/phase3/thumb.php
@@ -51,6 +51,7 @@
5252
5353 // OK, no valid thumbnail, time to get out the heavy machinery
5454 require_once( 'Setup.php' );
 55+wfProfileIn( 'thumb.php' );
5556
5657 $img = Image::newFromName( $fileName );
5758 if ( $img ) {
@@ -72,5 +73,7 @@
7374 </body></html>";
7475 }
7576
 77+wfProfileOut( 'thumb.php' );
7678
 79+
7780 ?>
Index: branches/REL1_5/phase3/includes/Profiling.php
@@ -245,10 +245,12 @@
246246 $subcalls = $this->calltreeCount($this->mStack, $index);
247247
248248 if (!preg_match('/^-overhead/', $fname)) {
249 - # Adjust for profiling overhead
250 - $elapsed -= $overheadInternal;
251 - $elapsed -= ($subcalls * $overheadTotal);
252 - $memory -= ($subcalls * $overheadMemory);
 249+ # Adjust for profiling overhead (except special values with elapsed=0
 250+ if ( $elapsed ) {
 251+ $elapsed -= $overheadInternal;
 252+ $elapsed -= ($subcalls * $overheadTotal);
 253+ $memory -= ($subcalls * $overheadMemory);
 254+ }
253255 }
254256
255257 if (!array_key_exists($fname, $this->mCollated)) {
Index: branches/REL1_5/phase3/includes/Image.php
@@ -915,6 +915,9 @@
916916 function renderThumb( $width, $useScript = true ) {
917917 global $wgUseSquid, $wgInternalServer;
918918 global $wgThumbnailScriptPath, $wgSharedThumbnailScriptPath;
 919+
 920+ $fname = 'Image::renderThumb';
 921+ wfProfileIn( $fname );
919922
920923 $width = IntVal( $width );
921924
@@ -922,18 +925,22 @@
923926 if ( ! $this->exists() )
924927 {
925928 # If there is no image, there will be no thumbnail
 929+ wfProfileOut( $fname );
926930 return null;
927931 }
928932
929933 # Sanity check $width
930934 if( $width <= 0 || $this->width <= 0) {
931935 # BZZZT
 936+ wfProfileOut( $fname );
932937 return null;
933938 }
934939
935940 if( $width >= $this->width && !$this->mustRender() ) {
936941 # Don't make an image bigger than the source
937 - return new ThumbnailImage( $this->getViewURL(), $this->getWidth(), $this->getHeight() );
 942+ $thumb = new ThumbnailImage( $this->getViewURL(), $this->getWidth(), $this->getHeight() );
 943+ wfProfileOut( $fname );
 944+ return $thumb;
938945 }
939946
940947 $height = floor( $this->height * ( $width/$this->width ) );
@@ -941,7 +948,9 @@
942949 list( $isScriptUrl, $url ) = $this->thumbUrl( $width );
943950 if ( $isScriptUrl && $useScript ) {
944951 // Use thumb.php to render the image
945 - return new ThumbnailImage( $url, $width, $height );
 952+ $thumb = new ThumbnailImage( $url, $width, $height );
 953+ wfProfileOut( $fname );
 954+ return $thumb;
946955 }
947956
948957 $thumbName = $this->thumbName( $width, $this->fromSharedDirectory );
@@ -976,7 +985,9 @@
977986 }
978987 }
979988
980 - return new ThumbnailImage( $url, $width, $height, $thumbPath );
 989+ $thumb = new ThumbnailImage( $url, $width, $height, $thumbPath );
 990+ wfProfileOut( $fname );
 991+ return $thumb;
981992 } // END OF function renderThumb
982993
983994 /**

Status & tagging log

  • 01:58, 13 October 2010 ^demon (Talk | contribs) changed the status of r10599 [removed: new added: old]
Personal tools
Namespaces

Variants
Views
Actions
Navigation
Support
Download
Development
Communication
Toolbox