| Index: branches/REL1_5/phase3/thumb.php |
| — | — | @@ -51,6 +51,7 @@ |
| 52 | 52 | |
| 53 | 53 | // OK, no valid thumbnail, time to get out the heavy machinery |
| 54 | 54 | require_once( 'Setup.php' ); |
| | 55 | +wfProfileIn( 'thumb.php' ); |
| 55 | 56 | |
| 56 | 57 | $img = Image::newFromName( $fileName ); |
| 57 | 58 | if ( $img ) { |
| — | — | @@ -72,5 +73,7 @@ |
| 73 | 74 | </body></html>"; |
| 74 | 75 | } |
| 75 | 76 | |
| | 77 | +wfProfileOut( 'thumb.php' ); |
| 76 | 78 | |
| | 79 | + |
| 77 | 80 | ?> |
| Index: branches/REL1_5/phase3/includes/Profiling.php |
| — | — | @@ -245,10 +245,12 @@ |
| 246 | 246 | $subcalls = $this->calltreeCount($this->mStack, $index); |
| 247 | 247 | |
| 248 | 248 | 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 | + } |
| 253 | 255 | } |
| 254 | 256 | |
| 255 | 257 | if (!array_key_exists($fname, $this->mCollated)) { |
| Index: branches/REL1_5/phase3/includes/Image.php |
| — | — | @@ -915,6 +915,9 @@ |
| 916 | 916 | function renderThumb( $width, $useScript = true ) { |
| 917 | 917 | global $wgUseSquid, $wgInternalServer; |
| 918 | 918 | global $wgThumbnailScriptPath, $wgSharedThumbnailScriptPath; |
| | 919 | + |
| | 920 | + $fname = 'Image::renderThumb'; |
| | 921 | + wfProfileIn( $fname ); |
| 919 | 922 | |
| 920 | 923 | $width = IntVal( $width ); |
| 921 | 924 | |
| — | — | @@ -922,18 +925,22 @@ |
| 923 | 926 | if ( ! $this->exists() ) |
| 924 | 927 | { |
| 925 | 928 | # If there is no image, there will be no thumbnail |
| | 929 | + wfProfileOut( $fname ); |
| 926 | 930 | return null; |
| 927 | 931 | } |
| 928 | 932 | |
| 929 | 933 | # Sanity check $width |
| 930 | 934 | if( $width <= 0 || $this->width <= 0) { |
| 931 | 935 | # BZZZT |
| | 936 | + wfProfileOut( $fname ); |
| 932 | 937 | return null; |
| 933 | 938 | } |
| 934 | 939 | |
| 935 | 940 | if( $width >= $this->width && !$this->mustRender() ) { |
| 936 | 941 | # 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; |
| 938 | 945 | } |
| 939 | 946 | |
| 940 | 947 | $height = floor( $this->height * ( $width/$this->width ) ); |
| — | — | @@ -941,7 +948,9 @@ |
| 942 | 949 | list( $isScriptUrl, $url ) = $this->thumbUrl( $width ); |
| 943 | 950 | if ( $isScriptUrl && $useScript ) { |
| 944 | 951 | // 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; |
| 946 | 955 | } |
| 947 | 956 | |
| 948 | 957 | $thumbName = $this->thumbName( $width, $this->fromSharedDirectory ); |
| — | — | @@ -976,7 +985,9 @@ |
| 977 | 986 | } |
| 978 | 987 | } |
| 979 | 988 | |
| 980 | | - return new ThumbnailImage( $url, $width, $height, $thumbPath ); |
| | 989 | + $thumb = new ThumbnailImage( $url, $width, $height, $thumbPath ); |
| | 990 | + wfProfileOut( $fname ); |
| | 991 | + return $thumb; |
| 981 | 992 | } // END OF function renderThumb |
| 982 | 993 | |
| 983 | 994 | /** |